Commit 6fdb64d
committed
tests: fix imports and test collection under some environments
While packaging json-logging for NixOS, I've come across two issues
with tests. Since neither are specific to NixOS (though they may be
an artifact of how the build environment is set up), I felt it'd be
better to try to stream the fixes up.
- While testing, the import test for Quart finds not the 'quart'
package, but tests/smoketests/quart. It's been a while since I
worked on this, but it seems to happen because pytest prepends
the test module directory to sys.path by default [1]. To make
it work with a default pytest invocation, we can simply try to
import something only the real quart package provides.
- If no smoketest backends are specified, it will try to find tests
in a __pycache__ directory [2] if it exists.
[1]: https://docs.pytest.org/en/stable/pythonpath.html
[2]: https://www.python.org/dev/peps/pep-3147/1 parent dc80372 commit 6fdb64d
File tree
2 files changed
+2
-2
lines changed- json_logging/framework/quart
- tests/smoketests
2 files changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
0 commit comments