pytest CATEGORIES
时间: 2023-10-26 15:23:11 浏览: 74
pytest
Pytest allows you to organize your tests using markers. These markers can be used to define categories for your tests. To list all available test categories, you can use the following command:
```
pytest --markers
```
This will display all the test markers defined in your project, including any custom markers you might have created. The output will show the marker name and its description. You can then use these markers to categorize your tests and run them selectively based on their categories.
For example, if you have a test marked with `@pytest.mark.slow`, you can run only the slow tests using the following command:
```
pytest -m slow
```
This will execute only the tests that are marked with the `slow` marker. You can replace `slow` with any other marker defined in your project to run tests belonging to different categories.
阅读全文