Chapter 5
■
pytest
91
You can also run a specific test class as follows:
py.test -v test/test_module02.py::TestClass01
You can run a specific test method as follows:
py.test -v test/test_module02.py::TestClass01::test_case01
You can run a specific test function as follows:
py.test -v test/test_module01.py::test_case01
Test
Discovery in pytest
pytest can discover and
automatically run the tests, just like unittest, nose, and nose2
can. Run the following command in the project directory
to initiate automated test
discovery:
py.test
For
verbose mode, run the following command:
py.test -v
xUnit-Style
Fixtures
pytest has xUnit-style of fixtures.
See the code in Listing
5-4
as an example.
Do'stlaringiz bilan baham: