Repository navigation
Commit 312499d
committed
Resolve the tests directory before changing into it
tests/utf8_locale.py computed os.path.dirname(os.path.abspath(__file__))
twice : once to chdir into tests, then again inside
rerun_with_non_utf8_locale() to give the child its cwd. Up to Python 3.8
__file__ stays relative to the directory the interpreter was started from,
so the second call resolved against the new directory and produced
tests/tests. `PYTHONPATH=. python3.8 tests/utf8_locale.py` from the
repository root died with FileNotFoundError before the child even started,
while Python 3.9+ passed because __file__ is absolute there.
Resolve the directory and the script name once, at import time, and reuse
them for both os.chdir() and the child cwd, so neither depends on the
current directory any more.
The PYTHONPATH handed to the child had the same problem : the child runs in
the tests directory, so a relative entry such as "." no longer pointed at
the repository root and docxtpl was not importable. Make its entries
absolute against the startup directory.1 parent 286eaf0 commit 312499d
1 file changed
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
26 | 33 | | |
27 | 34 | | |
28 | 35 | | |
| |||
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
44 | 60 | | |
45 | 61 | | |
46 | 62 | | |
47 | | - | |
48 | | - | |
| 63 | + | |
| 64 | + | |
49 | 65 | | |
50 | 66 | | |
51 | 67 | | |
| |||
98 | 114 | | |
99 | 115 | | |
100 | 116 | | |
101 | | - | |
| 117 | + | |
102 | 118 | | |
103 | 119 | | |
104 | 120 | | |
105 | 121 | | |
106 | | - | |
| 122 | + | |
107 | 123 | | |
108 | 124 | | |
109 | 125 | | |
| |||
0 commit comments