nose2

Force nose2 to use Python 2.7 instead of Python 3.5

青春壹個敷衍的年華 提交于 2020-01-15 08:51:07
问题 Similar to Force Nosetests to Use Python 2.7 instead of 3.4, I've written some unit tests in Python 2 which I'd like to run in Python 2. However, by default my installation of nose2 seems to try to run Python 3. For example, if I try to run unittest_controller.py I get output ending with Ran 4 tests in 1.552s OK whereas if I use the command nose2 from the same directory, I get ImportError: No module named 'StringIO' ---------------------------------------------------------------------- Ran 2

how to specify test specific setup and teardown in python unittest

丶灬走出姿态 提交于 2019-12-25 01:14:57
问题 I want to create unittest test with two different set up and tearDown methon in same class with two different test. each test will use its specific setUp and tearDown method in python unittest framework. could anyone help me. class processtestCase(unittest.TestCase): print "start the process test cases " def setUp1(self): unittest.TestCase.setUp(self) def test_test1(self): "test Functinality" def tearDown1(self): unittest.TestCase.tearDown(self) def setUp2(self): unittest.TestCase.setUp2(self

Skip a unit test from a Nose2 Plugin

一笑奈何 提交于 2019-12-22 10:27:24
问题 I'm having trouble actually skipping a unit test from a Nose2 plugin. I am able to mark the test skipped and see the reason in the final result, but the test still runs. This example code should basically skip any test, as long as the plugin is active. from nose2.events import Plugin class SkipAllTests(Plugin): def startTest(self, event): event.result.addSkip(event.test, 'skip it') event.handled = True If I call event.test.skipTest('reason') it actually raises the SkipTest exception like it

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

Skip a unit test from a Nose2 Plugin

╄→尐↘猪︶ㄣ 提交于 2019-12-05 21:00:23
I'm having trouble actually skipping a unit test from a Nose2 plugin. I am able to mark the test skipped and see the reason in the final result, but the test still runs. This example code should basically skip any test, as long as the plugin is active. from nose2.events import Plugin class SkipAllTests(Plugin): def startTest(self, event): event.result.addSkip(event.test, 'skip it') event.handled = True If I call event.test.skipTest('reason') it actually raises the SkipTest exception like it should, it's just that the exception isn't caught by the test runner, it just raises inside of my

how to specify test specific setup and teardown in python unittest

情到浓时终转凉″ 提交于 2019-12-03 00:51:38
问题 I want to create unittest test with two different set up and tearDown methon in same class with two different test. each test will use its specific setUp and tearDown method in python unittest framework. could anyone help me. class processtestCase(unittest.TestCase): print "start the process test cases " def setUp1(self): unittest.TestCase.setUp(self) def test_test1(self): "test Functinality" def tearDown1(self): unittest.TestCase.tearDown(self) def setUp2(self): unittest.TestCase.setUp2(self