I'm writing some tests and test them with nosetests
All my tests are in multiples classes from object
, and I try to access to the test name (like test_ipam_get.TestIPAMGet.test_noAuth
).
Example test class :
class TestIPAMGet(object):
@classmethod
def setup_class(cls):
app.config['TESTING'] = True
cls.web = app.test_client()
@classmethod
def teardown_class(cls):
pass
def test_noAuth(self):
client = self.web.get('/api/v0.1/')
assert_equal(client.status_code , 401)
Nose produce me this output :
test_ipam_get.TestIPAMGet.test_noAuth... ok
I tried to access to the test name. According to A way to output pyunit test name in setup(), I can inherit from unittest.Testcase
and use self.id()
and it works.
But now, my nose output change to :
test_noAuth (test_ipam_get.TestIPAMGet) ... ok
- Can you explain why and what's the difference ?
- Is it possible to get the test name without using the inheritance ?