3 ms·
They're ultimately trying to match files, directories, method names, and class names they assume to contain tests. You could certainly check it with maybe
by bobwaycott 11y ago
They're ultimately trying to match files, directories, method names, and class names they assume to contain tests.
You could certainly check it with
maybe.lower().startswith(test_string)
and
maybe.lower().endswith(test_string)
to accomplish part of what appears to be originally desired. But it's just a part.
Python expects explicit behavior, and nose would do well to improve itself by providing interfaces for detecting, registering, and running tests by file, directory, method, or class in clear, provably correct ways.
It'd be far more reliable to start with a provable interface to `os.walk()` through a directory/tree, grab the Python files, load & test the classes to ensure they are of the desired type, and execute them--assuming here the tests are written via classes and not just modules full of random methods you hope include the word 'test', or you hope are actually meant for nose tests, and not something application-specific. Or perhaps offer a decorator for standalone methods when that is a developer's chosen pattern. Or provide a single default directory that is searched, and a flag that allows a dev to override it. Same for files--provide a sane default filename that is searched via `os.walk()` for collecting tests, with a flag to specify a different filename where desired.
Slower, sure. But at least not completely fucked up and wrong. Once they can prove it works 100% of the time, then they can go about digging into making it better and faster. But for fuck's sake, start with the simplest working solution and build from there. Especially when the problem has existed for more than 5 years.
EDIT: Oops, misplaced the lowers. It's that time of the night when I shouldn't be writing code.