unittest2

python nose from a script, gathers test classes from files and then runs tests

╄→尐↘猪︶ㄣ 提交于 2019-12-12 20:09:48
问题 How would I use nose from a python script to gather python files from a directory foreach file run all test classes found using passed parameters Here's an example, given files /run.py /tests/TestClassA.py and within TestClassA.py is the code class A(): __init__(self, b): self._b = b test_run(): print("%s",self._b) To restate the need: I want to call nose from run.py. I want nose (or some part of nose) to find class A in file TestClassA.py create an instance of A , named a , passing the

How to run specific test in Nose2

假如想象 提交于 2019-12-08 14:52:33
问题 In previous version of Nose testing framework, there were several ways to specify only a subset of all tests: nosetests test.module nosetests another.test:TestCase.test_method nosetests a.test:TestCase nosetests /path/to/test/file.py:test_function http://nose.readthedocs.org/en/latest/usage.html#selecting-tests However, I can't find any information about similar test selection in Nose2. There's a mention in docs about different test discovery, but that doesn't seem to be related. Is there a

How to run unittest discover from “python setup.py test”?

。_饼干妹妹 提交于 2019-11-28 03:53:25
I'm trying to figure out how to get python setup.py test to run the equivalent of python -m unittest discover . I don't want to use a run_tests.py script and I don't want to use any external test tools (like nose or py.test ). It's OK if the solution only works on python 2.7. In setup.py , I think I need to add something to the test_suite and/or test_loader fields in config, but I can't seem to find a combination that works correctly: config = { 'name': name, 'version': version, 'url': url, 'test_suite': '???', 'test_loader': '???', } Is this possible using only unittest built into python 2.7?

How to run unittest discover from “python setup.py test”?

雨燕双飞 提交于 2019-11-27 05:13:15
问题 I'm trying to figure out how to get python setup.py test to run the equivalent of python -m unittest discover . I don't want to use a run_tests.py script and I don't want to use any external test tools (like nose or py.test ). It's OK if the solution only works on python 2.7. In setup.py , I think I need to add something to the test_suite and/or test_loader fields in config, but I can't seem to find a combination that works correctly: config = { 'name': name, 'version': version, 'url': url,