Details
-
Type:
RFC
-
Status: Implemented
-
Resolution: Done
-
Component/s: DM
-
Labels:None
Description
Now that we’re beginning to use pytest to run unit tests, it makes sense to use pytest’s default test discovery so that simply running py.test (without arguments) will have pytest discover and run all tests in the tests/ directory. Currently we must type py.test tests/*.py.
We can achieve this simplicity through a coding standard that specifies all Python unit test modules must be named with the test_ pattern:
tests/test_example.py
|
(Our current standard is tests/testExample.py. The Python Style Guide implies this style, and the Python Unit Testing guide assumes this naming style.)
I think this is a straightforward coding style change that will make life easier in the long run.
An alternative to changing the names of test modules, while still making py.test work without arguments is to add a configuration file to each repo that tells pytest how to find our test modules.
I don’t recommend this. I think it’s better just to use a correct and consistent naming schema.
Attachments
Issue Links
- is blocked by
-
DM-8467 Wrap lsst_distrib with pybind11
- Done
- is triggering
-
DM-9024 Amend Python test naming guidelines in Developer Guide Following RFC-229
- Done
- relates to
-
DM-7600 Pytest and Flake8 integration with CI and sconsUtils
- Done
-
RFC-215 Disallow executable tests due to "#!/usr/bin/env python" problems on OSX
- Adopted
-
RFC-370 Use pytest for test execution in sconsUtils
- Implemented
- mentioned in
-
Page Loading...
Activity
Resolution | Done [ 10000 ] | |
Status | Proposed [ 10805 ] | Adopted [ 10806 ] |
Remote Link | This issue links to "Page (Confluence)" [ 14907 ] |
Remote Link | This issue links to "Page (Confluence)" [ 14907 ] |
Remote Link | This issue links to "Page (Confluence)" [ 15080 ] |
Status | Adopted [ 10806 ] | Implemented [ 11105 ] |