run pytest in
时间: 2023-10-12 19:10:55 浏览: 86
To run pytest in a Python project, you first need to install pytest using pip. You can do this by running the following command in your terminal:
```
pip install pytest
```
Once pytest is installed, navigate to the root directory of your Python project in the terminal and run the following command:
```
pytest
```
This will search for all files with names that match the pattern `test_*.py` or `*_test.py` in the current directory and its subdirectories, and run all tests in those files.
You can also specify a specific file or directory to run tests in by passing its path as an argument to pytest. For example:
```
pytest tests/test_foo.py
```
This will only run tests in the `test_foo.py` file located in the `tests` directory.
阅读全文
相关推荐


















