Executing the pytest command (without mentioning a filename) on the terminal will run all the Python files that have filenames starting with test_* or ending with *_test. These files are automatically identified as test files by the pytest framework.
The framework also mandates that the test methods should start with ‘test’ else the method will not be considered for execution. Below are two mandatory requirements for test code for Selenium testing with Python & pytest.
File naming nomenclature - File name should be test_*.py or *_test.py Test Method nomenclature - Test method should be of the format test*
These are mandatory requirements as pytest has features built-in to the framework that supports auto-discovery of test modules and test methods (or functions).