fix: Convert class-scoped fixtures in built-in integration tests into @classmethods#3676
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideConverts deprecated class-scoped instance fixtures in CSV/Parquet integration tests and the shared test runner to class methods compatible with newer pytest versions, refines a config-path fixture with typing and clearer flow, and updates pytest version and warning filters accordingly. Sequence diagram for class-scoped runner fixture as classmethodsequenceDiagram
participant Pytest
participant TestClass
participant test_runner
Pytest->>TestClass: runner()
TestClass->>test_runner: sync_all()
TestClass-->>Pytest: test_runner
Pytest->>test_runner: execute tap/target tests
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Converting
@pytest.fixture(scope="class")methods to@classmethods is unlikely to work as intended with pytest’s fixture mechanism (fixtures are plain callables with injected dependencies, notclassmethods); consider keeping them as instance methods or switching to xunit-stylesetup_class/teardown_classif you need true classmethods. - The new classmethod fixtures still declare parameters like
test_output_dir: Path, but pytest won’t inject fixture arguments into aclassmethodin the usual way, so either revert them to standard fixtures or adjust the design so dependencies are obtained viarequest.cls/shared state instead of parameters.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Converting `@pytest.fixture(scope="class")` methods to `@classmethod`s is unlikely to work as intended with pytest’s fixture mechanism (fixtures are plain callables with injected dependencies, not `classmethod`s); consider keeping them as instance methods or switching to xunit-style `setup_class`/`teardown_class` if you need true classmethods.
- The new classmethod fixtures still declare parameters like `test_output_dir: Path`, but pytest won’t inject fixture arguments into a `classmethod` in the usual way, so either revert them to standard fixtures or adjust the design so dependencies are obtained via `request.cls`/shared state instead of parameters.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
276e5f1 to
8985d60
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3676 +/- ##
=======================================
Coverage 94.12% 94.12%
=======================================
Files 73 73
Lines 6199 6200 +1
Branches 762 762
=======================================
+ Hits 5835 5836 +1
Misses 270 270
Partials 94 94
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
8985d60 to
bdfb571
Compare
… `@classmethod`s Signed-off-by: Edgar Ramírez Mondragón <[email protected]>
bdfb571 to
cdfcd3d
Compare
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Using
@classmethodtogether with@pytest.fixture(scope="class")is an unusual pattern that may be brittle; consider converting these to plain function-level fixtures (outside the test classes) or class-scoped fixtures that takerequestinstead ofclsto align with pytest’s recommended usage and make future maintenance clearer.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Using `@classmethod` together with `@pytest.fixture(scope="class")` is an unusual pattern that may be brittle; consider converting these to plain function-level fixtures (outside the test classes) or class-scoped fixtures that take `request` instead of `cls` to align with pytest’s recommended usage and make future maintenance clearer.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
… `@classmethod`s (#3676) (#3677) SSIA, backport of #3676 ## Summary by Sourcery Convert class-scoped pytest fixtures in built-in integration tests to class methods and update pytest version constraint for testing. Enhancements: - Refactor test_target_csv and test_target_parquet to define class-scoped fixtures as @classmethods for better compatibility with newer pytest versions. Build: - Bump pytest testing dependency to >=9.1 in pyproject.toml. Tests: - Adjust factory-based runner fixture to be a class method to align with updated fixture patterns in generated tests. Signed-off-by: Edgar Ramírez Mondragón <[email protected]>
- **fix: Ensure stream name is include in log message when ACTIVATE_VERSION forces _sdc metadata columns (meltano#3650)** - **chore: Release v0.54.3 (meltano#3651)** - **fix: Emitted `ACTIVATE_VERSION` now honor the stream aliases configured with stream maps (meltano#3654)** - **chore: Release v0.54.4 (meltano#3655)** - **chore: Lock file maintenance** - **fix: Convert class-scoped fixtures in built-in integration tests into `@classmethod`s (meltano#3676) (meltano#3677)** - **chore: Release v0.54.5 (meltano#3678)** ## Summary by Sourcery Release version v0.54.5 and align templates, docs, and tooling with the new version. Bug Fixes: - Document the fix converting class-scoped fixtures in built-in integration tests to use @classmethods in the changelog. Enhancements: - Update cookiecutter tap/target/mapper templates to depend on singer-sdk v0.54.5. Build: - Update project version metadata to 0.54.5 in pyproject and related tooling configuration. Documentation: - Bump documented release version to 0.54.5 in the Sphinx configuration and GitHub bug report template. --------- Signed-off-by: Edgar Ramírez Mondragón <[email protected]> Co-authored-by: MeltyBot <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
SSIA, pytest-dev/pytest#14071
Summary by Sourcery
Update built-in integration tests and related configuration to comply with pytest 9.1 class-scoped fixture requirements.
Build:
Tests: