Commit d3e25cc
committed
test: exec the codespell executable consistently
Currently, in test_basic.py, the run_codespell and run_codespell_stdin
functions exec the codespell script from PATH, not the one from the
current directory. This means that the codespell_lib package MUST first
be installed, before running pytest.
The current behavior is unsafe, since an user running pytest in the
global environment may get an error or, worse, may actually try to test
an old version. Additionally this behavior is not documented in
README.md.
Update the run_codespell and run_codespell_stdin functions to exec the
codespell script via `python -m codespell_lib`. This change will ensure
that python will try to search the __main__ module from the current
directory first. Copy the codespell_lib directory to the cwd directory,
and configure codespell to ignore it using the `-S` option, in order to
make the environment clean.
Ensure that the cwd parameter in run_codespell and run_codespell_stdin
is never None, since the codespell script must not be executed from the
current directory. For consistency, also make the args parameter
required.1 parent f6a0fcb commit d3e25cc
1 file changed
+13
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | | - | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
86 | | - | |
| 88 | + | |
87 | 89 | | |
88 | | - | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| |||
1196 | 1198 | | |
1197 | 1199 | | |
1198 | 1200 | | |
1199 | | - | |
| 1201 | + | |
1200 | 1202 | | |
1201 | 1203 | | |
| 1204 | + | |
| 1205 | + | |
1202 | 1206 | | |
1203 | | - | |
| 1207 | + | |
1204 | 1208 | | |
1205 | 1209 | | |
1206 | 1210 | | |
| |||
0 commit comments