-
Notifications
You must be signed in to change notification settings - Fork 136
Open
Description
Description
I'm trying to use mutmut with a Django project but running into issues with path resolution and import paths.
Project structure
my_project/
├── kiosk/
│ ├── __init__.py
│ ├── services/
│ │ ├── __init__.py
│ │ └── kiosk_payment_service.py # Source to mutate
│ └── tests/
│ └── services/
│ └── test_kiosk_payment_service.py # Tests
├── mutants/ # Created by mutmut
│ └── kiosk/
│ └── services/
│ └── kiosk_payment_service.py # Mutated code
├── setup.cfg
└── pyproject.toml
Issue 1: File not found with relative path
Configuration:
[mutmut]
paths_to_mutate=kiosk/services/kiosk_payment_service.py
tests_dir=kiosk/tests/services/test_kiosk_payment_service.py
debug=trueError:
ERROR: file or directory not found: kiosk/tests/services/test_kiosk_payment_service.py
This happens because mutmut runs pytest from inside the mutants/ directory, so kiosk/tests/... doesn't exist there.
Issue 2: Tests pass but mutations not detected
Configuration (using ../ to fix path):
[mutmut]
paths_to_mutate=kiosk/services/kiosk_payment_service.py
tests_dir=../kiosk/tests/services/test_kiosk_payment_service.py
debug=trueResult:
========= 64 passed in 10.75s ==========
exit code 0
Stopping early, because we could not find any test case for any mutant.
It seems that the selected tests do not cover any code that we mutated.
The tests run successfully, but mutmut reports no coverage of mutated code.What I've tried
- Using also_copy to include init.py files — didn't help
- Various path configurations — same results
Question
Is there a recommended way to use mutmut with Django projects? Should setup_source_paths() be extended to handle arbitrary paths_to_mutate values?
Environment
- Python: 3.11
- mutmut: 3.4.0
- Django: 4.2
- OS: macOS
Metadata
Metadata
Assignees
Labels
No labels