Skip to content

Conversation

@souradeep-das
Copy link
Contributor

Overview

closes #368

Changes

Adds test_dir to the config, allowing specific tests to be run

Notes

The logic has been added to each high level method, instead of PytestRunner.execute_pytest thinking about fine-grained control. Do lmk if that needs to be changed

@Otto-AA
Copy link
Collaborator

Otto-AA commented Jul 12, 2025

Hi @souradeep-das , thanks for this PR! I tested it out and it looks good :)

One thing that we should change is to support a list of directories (eg tests_dir = [ "tests/" ] in pyproject.toml), rather than only a single directory.

It would also be good to have an E2E test for this. If you want to do this: in e2e_projects/config you could create two test directories (e.g. move test_main.py to tests/main/test_main.py and create a new tests/ignored/test_ignored.py) and then add tests_dir=[ "tests/main" ] in this pyproject.toml. The test_ignored.py should test some function that is not tested by test_main.py (maybe you need to create this function), so we can verify that the tests got ignored and the mutants are reported as untested (code 33). See CONTRIBUTING.rst on how to run the tests and update the snapshots.

I can also add the E2E test if you want.

Apart from that, a small nitpick: instead of getattr(mutmut.config, 'tests_dir', None) we can directly use mutmut.config.tests_dir. The typing is wrong, but the config should always be loaded.

@souradeep-das
Copy link
Contributor Author

Thanks for the review and comments @Otto-AA! Updated the code and the e2e tests. Do lmk if there needs to be any other changes. :)

@Otto-AA Otto-AA merged commit 3cd39fa into boxed:main Jul 17, 2025
5 checks passed
@Otto-AA
Copy link
Collaborator

Otto-AA commented Jul 17, 2025

Awesome, thanks for the E2E test and the list fix!

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.

tests_dir configuration is gone?

2 participants