Skip to content

Commit fdae4f1

Browse files
committed
tests: add section about pytest and the module lookup for the TDD theme
1 parent 06d87a3 commit fdae4f1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/testing.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ pdm run pytest
6464
rye run pytest
6565
```
6666

67+
#### Running tests with pytest and the TDD Theme
68+
This configuration ensures the entire namespace of your brick is included
69+
when `pytest` does it's test lookup. Without it, `pytest` will raise errors
70+
because of the default way it does module lookups. This occurs when using Polylith with the _TDD_ theme.
71+
72+
``` toml
73+
[tool.pytest.ini_options]
74+
addopts = [
75+
"--import-mode=importlib",
76+
]
77+
```
78+
6779
### Running tests for changed code
6880
The __Python tools__ for the Polylith Architecture doesn't (yet) have a specific `test` command.
6981
You can use `poly diff` and your favorite test runner to only run the corresponding tests for changed code.

0 commit comments

Comments
 (0)