English 中文(简体)
Identifying Test files and Functions
  • 时间:2024-12-22

Identifying Test files and Test Functions


Previous Page Next Page  

Running pytest without mentioning a filename will run all files of format test_*.py or *_test.py in the current directory and subdirectories. Pytest automatically identifies those files as test files. We can make pytest run other filenames by exppcitly mentioning them.

Pytest requires the test function names to start with test. Function names which are not of format test* are not considered as test functions by pytest. We cannot exppcitly make pytest consider any function not starting with test as a test function.

We will understand the execution of tests in our subsequent chapters.

Advertisements