Skip to content

Add PyTest IDs for better readability and filtering#409

Merged
chrisjkuch merged 7 commits intodrivendataorg:masterfrom
GatlenCulp:add-test-names
Mar 5, 2025
Merged

Add PyTest IDs for better readability and filtering#409
chrisjkuch merged 7 commits intodrivendataorg:masterfrom
GatlenCulp:add-test-names

Conversation

@GatlenCulp
Copy link
Contributor

@GatlenCulp GatlenCulp commented Dec 30, 2024

This small PR adds dynamically generated IDs for the config parameters. This makes it immediately clear which configuration failed and allows for filtering with pytest -k EXPRESSION. Ex: To only run the tests using conda and mkdocs you can do pytest -k "conda and mkdocs".

def pytest_generate_tests(metafunc):
    # setup config fixture to get all of the results from config_generator
    def make_test_id(config): # NEW
        return f"{config['environment_manager']}-{config['dependency_file']}-{config['docs']}"
    
    if "config" in metafunc.fixturenames:
        metafunc.parametrize(
            "config",
            config_generator(metafunc.config.getoption("fast")),
            ids=make_test_id # NEW
        )

Before:
GatScreen_2024-12-30_17 39 15@2x

After:
GatScreen_2024-12-30_17 44 33@2x

(Screenshots from VSCode Test Explorer)

The changes to pyproject.toml and .gitignore are small changes for my local development which you're free to add or ignore.

@GatlenCulp GatlenCulp marked this pull request as ready for review December 30, 2024 22:45
@chrisjkuch
Copy link
Contributor

Sorry for the delay on this @GatlenCulp - would you mind fixing the linting issue so I can run the tests?

fix linting error
chrisjkuch and others added 2 commits February 16, 2025 08:51
@chrisjkuch chrisjkuch added this to the v2.0.2 milestone Feb 26, 2025
Copy link
Contributor

@chrisjkuch chrisjkuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment, then looking for another reviewer and we should be good to go!

Copy link
Contributor

@chrisjkuch chrisjkuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the PR - I've made a few slight tweaks and now looks good to me! Will get another reviewer to check my work, then we're planning to merge for a 2.0.2 release with #387 and #408

Copy link
Member

@jayqi jayqi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chrisjkuch chrisjkuch merged commit 064eeba into drivendataorg:master Mar 5, 2025
16 checks passed
proinsias added a commit to proinsias/cookiecutter-data-science-proinsias that referenced this pull request Nov 3, 2025
* upstream/master: (24 commits)
  Add poetry as an env manager (drivendataorg#460)
  Support pixi as environment manager (drivendataorg#459)
  Docs: Add guidelines for contributing and requesting tools (drivendataorg#456)
  Fix terminal animation generation in docs build (drivendataorg#451)
  Fix failing pipenv installation on Windows GH actions runners (drivendataorg#453)
  Fix typo in using-the-template.md (drivendataorg#448)
  Bump to v2.2.0 [skip ci]
  Update HISTORY.md [skip ci]
  Add option for tests (drivendataorg#447)
  Resolve python version to work with compatible operator (drivendataorg#446)
  Add pyproject.toml as a dependencies file option (drivendataorg#436)
  Make PyPI badges links to PyPI (drivendataorg#440)
  Update to version v2.1.0 (drivendataorg#438)
  Add back isort configuration that was removed in drivendataorg#387 (drivendataorg#439)
  add badges to readme and docs homepage (drivendataorg#434)
  Added support for the uv package and project manager (drivendataorg#408)
  Add ruff as default linting + formatting option (drivendataorg#387)
  Add PyTest IDs for better readability and filtering (drivendataorg#409)
  prepare for 2.0.1 release by bumping version in pyproject.toml and updating change log (drivendataorg#422)
  Fix pre-prompt ccds version error (drivendataorg#426)
  ...
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.

3 participants