Commit 60b186f
committed
test: unify test loading on Python 2 & 3
On Python 3 load_tests() function that is defined in
unit/suites/__init__.py is called to filter unittest.TestCase classes to
run.
On Python 2 the function is not called and all unittest.TestCase classes
are subject to run. I plan to define a hierarchy of test cases in the
schema reload test and exclude the base class from the list to run, so
this behaviour is not desired.
The reason of the difference between unittest behaviour on Python 2 and
Python 3 is described in the TestLoader#discover() function
documentation (see [1]):
| Changed in version 3.5: Found packages are now checked for load_tests
| regardless of whether their path matches pattern, because it is
| impossible for a package name to match the default pattern.
The default pattern is 'test*.py'.
[1]: https://docs.python.org/3/library/unittest.html#unittest.TestLoader.discover1 parent 3a915f1 commit 60b186f
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
0 commit comments