Skip to content

Commit 7fa83ef

Browse files
Document how MYPYPATH and PYTHONPATH behave (#41)
1 parent 799e645 commit 7fa83ef

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ just execute:
2323
pytest
2424
```
2525

26+
### Paths
27+
28+
The `PYTHONPATH` and `MYPYPATH` environment variables, if set, are passed to `mypy` on invocation.
29+
This may be helpful if you are testing a local plugin and need to provide an import path to it.
30+
31+
Be aware that when `mypy` is run in a subprocess (the default) the test cases are run in temporary working directories
32+
where relative paths such as `PYTHONPATH=./my_plugin` do not reference the directory which you are running `pytest` from.
33+
If you encounter this, consider invoking `pytest` with `--mypy-same-process` or make your paths absolute,
34+
e.g. `PYTHONPATH=$(pwd)/my_plugin pytest`.
35+
36+
2637
### What is a test case?
2738

2839
In general each test case is just an element in an array written in a properly formatted `YAML` file.

0 commit comments

Comments
 (0)