3 ms·
py.test has a different way of finding tests. It loads Python files starting with "test_" or ending in "_test.py" then uses reflection, to find functions starti
by vii 6y ago
py.test has a different way of finding tests. It loads Python files starting with "test_" or ending in "_test.py" then uses reflection, to find functions starting with "test_" or classes starting with "Test", or functions marked with the attribute "__test__" (which is applied by the @nose.tools.istest decorator). See https://github.com/pytest-dev/pytest/blob/d69abff2c7de8bc65b7f1ef867dec5b5b9c564bd/src/_pytest/python.py#L360 https://github.com/pytest-dev/pytest/blob/d69abff2c7de8bc65b...
This mechanism of scanning the AST is a different approach and won't find the same set of tests. Scanning the AST can be useful and things like https://macropy3.readthedocs.io/en/latest/ https://macropy3.readthedocs.io/en/latest/ are awesome though!