问题
I'm trying to build and run (selenium which is not relevant) test-suite with pytest framework.
I wrote a simple test as follows
class test_pqr():
def test_lmn(self):
print("AAAAAAAAAAAAAAAAAAAAA")
assert True
def test_xyz(self):
assert False
x= test_pqr()
x.test_lmn()
when I run it I got result...
if I run xyz as well... eg
class test_pqr():
def test_lmn(self):
print("AAAAAAAAAAAAAAAAAAAAA")
assert True
def test_xyz(self):
assert False
x= test_pqr()
x.test_lmn()
x.test_xyz()
get results as...
what dose
imported unittest before running pytest.main
error means?
why can't it discover test?
collected 0 items
why are methods run only when there is error?
回答1:
After a long search and trial and error found the culprit. You should name class Test_*..
T in UPPER CASE for Class
t in lower case for methods...
though tests are running as supposed, the error remains...
来源:https://stackoverflow.com/questions/49642618/pytest-not-discovering-test-in-pydev