I am trying to run test with nose and here is project structure:
ForTest
├── test_module
│ └── test_suite.py
└── test_runner.py
test_suite.py contains:
def test_1():
pass
def test_2():
pass
and test_runner.py contains next:
import nose
nose.main(argv=['','-v']).run_and_exit()
when I run test_runner.py I have next content in output:
test_suite.test_1 ... ok
test_suite.test_2 ... ok
test_suite.test_1 ... ok
test_suite.test_2 ... ok
----------------------------------------------------------------------
Ran 2 tests in 0.002s
OK
Nose runs tests twice. If I connect myself plugin, I can see, for example, that mehtod addSuccess() calls 4 times. Could you explain me, why do I get this behaviour and how can I prevent it?
You can rename your test_runner.py
to runner.py
, this way nose does not treat your test runner as a test itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With