[issue16312] New command line option supported by unittest.main() for running initialization code before tests

Vinay Sajip report at bugs.python.org
Mon Oct 29 01:38:25 CET 2012


Vinay Sajip added the comment:

@Michael: When unit testing one's own projects, I agree with you. But I think Piotr's use case is when you download some new library from PyPI or clone it from GitHub/BitBucket/etc., and you want to run tests on that code without changing any of it, as you're just exploring at this point. Now ideally you'd just be able to do e.g.

python setup.py test --logconfig filename.json

or, if it isn't set up to do that, at least look for a test folder with scripts that have 'if __name__ == "__main__": unittest.main()', which I can then run. In either of these cases, even if the library I'm testing uses logging, I can't readily make use of it to look at DEBUG messages, say, unless I write some code (not much code, I grant you).

Of course, once you get to the point where you've decided to use that library in your project, you would integrate its logging setup with the logging setup of your own code, in your tests.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16312>
_______________________________________


More information about the Python-bugs-list mailing list