User12547645
User12547645

Reputation: 8477

What is the correct folder structure and naming convention for pytest?

Why does pytest not collect my test?

My folder structure:

src
|-- examplemodule.py
tests
|-- test_examplemodule.py 

Content of test_examplemodule.py:

from unittest import TestCase

class TestExamplemodule(TestCase):
    def run_mock_example(self):
        # do stuff

Running python3 -m pytest tests gives me collected 0 tests

Upvotes: 1

Views: 1669

Answers (1)

anosha_rehan
anosha_rehan

Reputation: 1600

The function name should start or end with test_ or _test respectively. So in your case test_run_mock_example()

Upvotes: 4

Related Questions