Clean up various pytest warnings#22472
Open
mvdbeek wants to merge 5 commits intogalaxyproject:devfrom
Open
Conversation
Pytest 8 warns (PytestReturnNotNoneWarning) when a test function returns a non-None value, and will turn it into an error in a future major version. Two API tests did this: - test_create_history_json returned the create_response dict; no callers, so just drop the return. - test_create_valid was both a test AND a factory that other tests called to obtain a freshly-created group. Extract the factory into _create_valid_group() and have the actual test just call it without returning — callers now use the helper.
lib/galaxy_test/base/decorators.py dynamically applies pytest.mark.requires_<tag> (for tag in admin, celery, new_history, new_library, new_published_objects, new_user), but none of those names were registered in pytest.ini — pytest emitted PytestUnknownMarkWarning for each. A stale 'require_new_history' (singular) entry was also present; drop it in favour of the plural form that matches what the code actually uses.
Pytest's default collection heuristic picks up any class whose name starts with 'Test'; when it tries to collect a class that has a __init__ / __new__ (e.g. a TypedDict or namedtuple) it emits a PytestCollectionWarning and skips it. Two such classes were being warned on: - galaxy.tool_util_models.TestJobDict (TypedDict) → JobTestDict - test.integration.test_datatype_upload.TestData (namedtuple) → DatatypeUploadCase Update all callers accordingly.
8acbc84 to
3b730e3
Compare
jmchilton
approved these changes
Apr 14, 2026
Tests were annotated with `@pytest.mark.require_new_history` (singular), which is not registered in pytest.ini (hence PytestUnknownMarkWarning) and, more importantly, does not attach the `__required_galaxy_features` attribute that populators.test_history_for reads via has_requirement(). As a result, those tests were silently reusing histories instead of getting a freshly-created one. Replace all such marker usages with the `requires_new_history` decorator from galaxy_test.base.decorators, which both registers the canonical `requires_new_history` marker and attaches the requirement attribute.
Drop `--cov-report term` so pytest no longer prints the per-file coverage table, and instead emit a single `Total coverage: N%` line after the run via `coverage report --format=total`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See commits for details
How to test the changes?
(Select all options that apply)
License