Open xcombelle opened 8 years ago
This is interesting.
It seems that it's because unittest
does some magic to do autodiscovery. I'll take a look.
It happens because unittest
discovery tries to load tests from __main__
module by default.
When module is run under vprof
, __main__
points to vprof
module, which does not have any tests and that's why line Ran 0 tests in 0.000s
is displayed.
I can suggest to specify module explicitly unittest.main(module=...)
if you need to run it under vprof
.
That sounds logical thanks for watching
Facing similar issue. Explicitly specifying the module too not working for me.
Works for me when I save this code to example_test.py
:
import unittest
class MyTest(unittest.TestCase):
def test_fail(self):
self.assertTrue(False)
unittest.main(module='example_test')
and run it.
With this code:
I get the following result
Both execution should have the same result