Repository navigation
Description
Background
In a recent pull request, I was notified that newly-added tests must go under tests/pytests/.
Problem
While it's great that this directory has a README which mentions that new tests should go here, it is much more likely that a prospective contributor to Salt will learn about test writing through the docs. And unfortunately, these docs are now out-of-date.
I've noted the problems I've been able to find below, but it's possible that I'm overlooking something (or that my proposed changes are themselves not 100% accurate). Looping in @s0undt3ch, @dwoz, and @barbaricyawps for additional insight I may lack.
Contributing
Right off the bat, the linked section of the Contributing page has incorrect info. It mentions that tests are in salt/tests/, but that's not correct. They are simply under tests/.
This section also links to the Writing Tests document, which leads me to...
Writing Tests
This page is a well-written, extremely-detailed description of the (now) deprecated Salt tests. It contains nothing having to do with the new pytests directory, and contributors who are new to the process, who follow the docs, will write them using unittest.TestCase, and will then (like I was) be told that the tests need to be moved and written using pytest.
This brings me to another problem. Once I moved and reformatted my tests, @s0undt3ch needed to make further changes to use some of the fixtures written specifically for the Salt test suite (master_opts, minion_opts, etc.). He shouldn't have to do that! We need some more documentation on the fixtures, as well as the skip markers that are used to conditionally skip tests, so that contributors can submit tests which don't need further cleanup by a member of the core team.
Proposed changes
- Change
salt/teststotests/here, and add information about new tests needing to go into the pytests dir. - Write new documentation on the Writing Tests page which covers the fact that new tests need to go under
tests/pytests/. This documentation should also include (or link to) documentation on the fixtures, skip markers, etc. which are unique to these new tests, including example usage (like the legacy test-writing docs have). - The outdated information on the Writing Tests page is still useful (and well done), so it should not be removed. It should be kept but put into a subsection of that RST document, with a note that it is there to document how the legacy tests work.
- The README in
tests/pytests/should be updated to link to the added docs, including those for the fixtures and skip markers, so that people who dive right into the repo and never visit the docs are still directed to the docs. - The updated Project Maintenance guidelines include references to tests, but do not link to any of the documentation about writing tests. Both the Contributing and Writing Tests pages should be linked from this page.
Wherever I can help out with this, please let me know.
Activity
[-][DOCS] Tests regarding test-writing are out-of-date[/-][+][DOCS] Docs regarding test-writing are out-of-date[/+]Updates to contributing docs
Updates to contributing docs