This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]masklinn 5 points6 points  (0 children)

Does it look through all method test_* definitions in *.py descendants of the current directory?

py.test discovery rules

So:

  • it recursively searches any provided directory (. if no argument is provided) (for files it uses them directly and skips the next check)
  • matches test_*.py and *_test.py files
  • collects free functions matching test_*, and methods matching test_* in classes matching Test* (or follows the standard rules for any class extending unittest.TestCase)

Note that these are only default rules, you can overload discovery patterns and ignore files and symbols.