Closed jayvdb closed 8 years ago
fwiw, solving https://github.com/CleanCut/green/issues/87 would also solve our needs, but it seems like this bug is much smaller, and can cause problems for projects which are not using load_tests
protocol.
The following is a workaround
$ green tests/*.py
As part of the Traditional feature, we lean on python's built-in unit test discovery. By default this means you are required to name your test module with the pattern test*.py
for it to be discovered under a directory, as explained in the tutorial (see note 4 under External Structure).
Also following the conventions of unittest, the file pattern can also be overridden. Under green --help
you will notice:
Other Options:
[...snip...]
-p PATTERN, --file-pattern PATTERN
Pattern to match test files. Default is test*.py
[...snip...]
As you discovered, you can also manually specify individual files (or dotted paths that correspond to any object from a package down to a test method) which bypass discovery and load the specified target.
For https://github.com/wikimedia/pywikibot-core , specifying the directory
tests/
causes only tests/tests_tests.py to be run.Ignore the ERRORs, Tracebacks and skips -- the above result is perfect, except that it is running 1 of 1000s of unit tests! Also running each test module works; e.g.
Renaming the 'tests_tests' module fixes this bug! e.g.
(green does fail somewhere in our test suites with an obscure message and traceback, which I'll raise as a separate bug once I've debugged it a little more)
Fwiw, I'd advise against trying to run the Pywikibot tests to understand this bug, as setting up the pywikibot tests is not fork and click. If the cause isnt immediately obvious, I can set up a simpler example of the problem, or fix it myself ;-)