Commit 88aec60
committed
Fix test module imports
This commit modifies `top_level_dir`, which is used to resolve module names
when loading unittests, to ensure, only modules from specified ST package are
importet.
Without this commit, UnitTesting might attempt to import packages/modules/tests
from Lib/ directory due to possible ambiguities.
Scenario:
Plugins of `MyPackage` are organized in `Packages/MyPackage/dirname/` and tests
in `Packages/MyPackage/dirname/tests/`. If a library `Lib/pythonXX/dirname`
exists, Unittesting would have attempted to import tests from that directory,
because test module paths would have been translated to `dirname.tests` due to
`top_level_dir` pointing to `Packages/MyPackage`.
By adjusting `top_level_dir` to `Packages/`, test module names are translated
to `MyPackage.dirname.tests` instead.1 parent f8be6fb commit 88aec60
1 file changed
+3
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
228 | 225 | | |
229 | 226 | | |
230 | 227 | | |
| |||
0 commit comments