File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,46 @@ addopts = [
68
68
]
69
69
```
70
70
71
+ ##### uv and the TDD Theme
72
+ The way Python paths are resolved sometimes differ between the Package & Dependency management tools
73
+ out there. For ` uv ` you might need to configure ` pytest ` to find the __ TDD Theme__ specific paths.
74
+ __ NOTE__ : this is not needed for the recommended _ loose_ theme.
75
+
76
+ ``` python
77
+ # running pytest with uv and the TDD theme
78
+
79
+ # conftest.py
80
+
81
+ import sys
82
+ from pathlib import Path
83
+
84
+
85
+ def pytest_configure (config ):
86
+ bases = Path.cwd().glob(" bases/**/**/src" )
87
+ components = Path.cwd().glob(" components/**/**/src" )
88
+
89
+ paths = list (bases) + list (components)
90
+
91
+ for path in paths:
92
+ sys.path.insert(0 , path.as_posix())
93
+ ```
94
+
95
+ ### Running doctests
96
+ ` pytest ` has a relatively new feature called _ consider_namespace_packages_ .
97
+ This feature is useful when running _ doctests_ .
98
+
99
+ Suggested ` pytest ` configuration to run the regular tests and also doctests:
100
+
101
+ ``` toml
102
+ [tool .pytest .ini_options ]
103
+ addopts = [
104
+ " --import-mode=importlib" ,
105
+ " --doctest-modules" ,
106
+ ]
107
+ consider_namespace_packages = true
108
+ ```
109
+
110
+
71
111
### Running tests for changed code
72
112
You can use ` poly diff ` in combination with your favorite test runner,
73
113
to only run the corresponding tests for changed code.
You can’t perform that action at this time.
0 commit comments