Skip to content

[MISC] Fail rig groups that inherit an unrelated pytest config; skip order-dependent connector tests#2205

Draft
chandrasekharan-zipstack wants to merge 3 commits into
mainfrom
fix/rig-config-guardrail
Draft

[MISC] Fail rig groups that inherit an unrelated pytest config; skip order-dependent connector tests#2205
chandrasekharan-zipstack wants to merge 3 commits into
mainfrom
fix/rig-config-guardrail

Conversation

@chandrasekharan-zipstack

Copy link
Copy Markdown
Contributor

Why

Two related test-rig defects surfaced while wiring cloud CI onto the rig.

1. A group can silently inherit another project's pytest config.
The rig runs cd <workdir> && pytest <paths> and never pins the config file. pytest resolves config by walking up from the workdir, so a group whose workdir is a nested project without its own config adopts its parent's addopts — coverage targets, --strict-config — and fails for reasons that have nothing to do with its tests. Observed symptom: ERROR: Unknown config option: asyncio_mode followed by no tests ran, and a tier exit 4.

--rootdir does not fix this (verified empirically — it moves rootdir but leaves ini-file discovery alone). Only an own config section, or -c, does.

This matters beyond the one case: workers/plugins/ holds 11 nested projects, each a future instance of the same trap.

2. Several connector tests are order-dependent and dormant.
They share a fixed table (or remote path) across test methods with no working teardown — several tearDown bodies are a bare pass with the drops commented out. They are inert only because their credentials aren't provisioned, so the breakage would appear as a surprise the moment someone adds them.

What

  • _resolve_pytest_configfile() mirrors pytest's upward search; _config_isolation_error() fails a group up front when the resolved config belongs to neither its workdir nor the repo root, with a message naming the offending file and the fix.
    • Inheriting the repo-root config stays allowed — that's the normal monorepo case, and unit-core / unit-platform-service rely on it today.
  • Explicit @unittest.skip with the reason stated on the 7 dormant connector test classes and the 2 SharePoint tests, so enabling credentials becomes a deliberate step.
    • The postgres variant is deliberately untouched: it runs today and is being fixed rather than skipped.

Verification

  • Guardrail checked against all 18 existing pytest groups — none rejected.
  • Rig self-tests: 86 passed, 1 skipped (5 new tests cover own-config, root-config, and nested-sibling-config cases).

🤖 Generated with Claude Code

https://claude.ai/code/session_01RnLaN45ShBbcCXWZkqCThz

chandrasekharan-zipstack and others added 2 commits July 24, 2026 15:36
…nfig

`cd workdir && pytest` does not pin config to workdir — pytest walks up
until it finds one. A group whose workdir is a nested project without its
own config therefore silently adopts its parent's addopts (coverage
targets, --strict-config) and fails for reasons unrelated to its tests.
The failure is opaque: a usage error, or zero tests collected.

Resolve the config file the same way pytest does and fail the group up
front with a message naming the offending file and the fix. Inheriting
the repo-root config stays allowed — that is the normal monorepo case,
and two groups rely on it today.

Verified against all 18 existing pytest groups: none are rejected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnLaN45ShBbcCXWZkqCThz
These tests share a fixed table (or remote path) across test methods with
no working teardown — several tearDown bodies are a bare `pass` with the
drop statements commented out. Results therefore depend on execution
order, and the SharePoint read test consumes what the write test leaves
behind.

They are inert today only because the credentials they need are not
provisioned, so the breakage would surface as a surprise the moment
someone adds them. Skip explicitly, with the reason stated, so enabling
credentials is a deliberate step rather than an accident.

The postgres variant is deliberately untouched — it runs today and is
being fixed rather than skipped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnLaN45ShBbcCXWZkqCThz
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6af43ae0-70e2-4a6c-9497-db6bbdde3565

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/rig-config-guardrail

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chandrasekharan-zipstack chandrasekharan-zipstack changed the title [FIX] Fail rig groups that inherit an unrelated pytest config; skip order-dependent connector tests [MISC] Fail rig groups that inherit an unrelated pytest config; skip order-dependent connector tests Jul 24, 2026
…gres

The lane reported 141 tests, 141 skipped: the rig provisions a
testcontainers Postgres and exports DB_*, but the workers fixtures read
TEST_DB_* and so fell back to the dev-compose defaults, and nothing ever
applied the pg_queue schema.

Mirror the provisioned DB_* onto TEST_DB_* for groups requiring postgres
(defaulting DB_SCHEMA to public — a bare container has no other schema),
and apply defaults.postgres_migrate once after the container is up and
before any group runs. Schema is a property of the database rather than
of a group, and guarding on the provisioned URL keeps it a no-op under
the compose runtime, where the platform's own backend migrates on start.

Django migrate rather than DDL in a fixture: the lane asserts against the
real generated CheckConstraint, which hand-written DDL would render
self-referential.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnLaN45ShBbcCXWZkqCThz
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant