-
Notifications
You must be signed in to change notification settings - Fork 52
Allow chaining noprocess fixtures - closes #890 #1259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds fixture chaining for postgresql_noproc via a new depends_on parameter, refactors DatabaseJanitor to require explicit dbname and an as_template flag, updates process integration and tests, adds docs (Mermaid diagram) and release fragments, and bumps the pytest minimum to >= 8.2. Changes
Sequence DiagramsequenceDiagram
participant Test
participant ProcF as BaseProc (proc fixture)
participant Noop1 as SeededNoop (noproc fixture)
participant Noop2 as MoreSeededNoop (noproc fixture)
participant DB as PostgreSQL Database
Test->>ProcF: request `base_proc`
ProcF->>DB: create base_db, load schema
ProcF-->>Test: return PostgreSQLExecutor (template dbname)
Test->>Noop1: request `seeded_noproc` (depends_on=`base_proc`)
Noop1->>ProcF: read connection & template info
Noop1->>DB: create seeded_db USING TEMPLATE base_db, load data
Noop1-->>Test: return NoopExecutor (seeded_db)
Test->>Noop2: request `more_seeded_noproc` (depends_on=`seeded_noproc`)
Noop2->>Noop1: read connection & template info
Noop2->>DB: create more_seeded_db USING TEMPLATE seeded_db, load more data
Noop2-->>Test: return NoopExecutor (more_seeded_db)
Test->>DB: validate tables and data across layers
Test-->>Test: assertions
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@pytest_postgresql/factories/noprocess.py`:
- Line 79: The pg_options local is being overwritten unconditionally after the
depends_on/else branches; remove the duplicate assignment so that pg_options
retains the value set in the depends_on branch (base.options) or the else branch
instead of always becoming config.options. Locate the code that assigns
pg_options in the factory function (the assignments at the depends_on branch
that set base.options, the else branch, and the later line `pg_options = options
or config.options`) and delete the later unconditional `pg_options = options or
config.options` so pg_options is only set by the intended branch logic.
🧹 Nitpick comments (1)
tests/test_chaining.py (1)
96-101: Consider adding assertion foroptionsinheritance.This test validates that
host,port,user, andpasswordare inherited, but does not verifyoptions. Given thepg_optionsoverwrite bug identified innoprocess.py, adding an assertion foroptionswould help catch such regressions.♻️ Suggested addition
assert seeded_noproc.host == base_proc.host assert seeded_noproc.port == base_proc.port assert seeded_noproc.user == base_proc.user assert seeded_noproc.password == base_proc.password + assert seeded_noproc.options == base_proc.options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/oldest-postgres.yml:
- Line 68: The pytest invocation in the workflow's `command:` duplicates
verbosity flags already present in `pyproject.oldest.toml`; remove `-vv
--setup-show` from the `command:` string so the command becomes `pytest -n auto
-c pyproject.oldest.toml --dist loadgroup --max-worker-restart 0
--postgresql-exec="/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" -k
"not docker" --cov-report=xml:coverage-xdist.xml`, leaving `addopts` in
`pyproject.oldest.toml` to control verbosity.
238899e to
34c0d4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@newsfragments/890.break.1.rst`:
- Around line 3-5: Fix the grammatical issues in the news fragment: change the
phrase "version behave flaky" to "versions behave flakily" (plural subject +
adverb) and remove the redundant word so "fixture chaining fixture" becomes
"fixture chaining". Ensure the resulting sentence reads smoothly with "versions
behave flakily with getfixturefunction requests on Python 3.12-3.13 in fixture
chaining when used alongside xdist."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@pyproject.toml`:
- Line 31: Add a breaking change newsfragment documenting the pytest bump
introduced in pyproject.toml: create a file in newsfragments/ (e.g.,
1XXXXX.break) that states pytest 8.2+ is now required, including why (what
changed) and migration notes for users; while adding the fragment, also verify
whether pytest 8.2 is truly necessary (inspect the change that prompted the bump
and any usage of features like fixture chaining from pytest-postgresql) and if a
lower pytest version suffices, update pyproject.toml accordingly and adjust the
newsfragment to reflect the accurate minimal required version.
This allows for more complex test suites with common base data fixture Extended for a specific group of tests that needs additional data elements in database Also bumped minimal supported pytest version to 8.2 as it's the earliest that safely runs fixture chaining
This allows for more complex test suites with common base data fixture
Extended for a specific group of tests that needs additional data elements in database
Chore that needs to be done:
pipenv run towncrier create [issue_number].[type].rstTypes are defined in the pyproject.toml, issue_number either from issue tracker or the Pull request number
Summary by CodeRabbit
New Features
Documentation
Tests
Breaking Changes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.