Skip to content

[DOCS] Docs regarding test-writing are out-of-date #66021

Closed

Description

@terminalmage

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/tests to tests/ 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

  1. added
    documentation
    on Feb 7, 2024
  2. changed the title [-][DOCS] Tests regarding test-writing are out-of-date[/-] [+][DOCS] Docs regarding test-writing are out-of-date[/+] on Feb 7, 2024
  3. self-assigned this
    on Feb 7, 2024
  4. added
    severity-medium
    and removed on Feb 7, 2024
  5. added a commit that references this issue on Feb 13, 2024
  6. added a commit that references this issue on Feb 14, 2024
  7. added this to the Sulphur v3006.26 milestone on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationseverity-mediumtime-estimate-sprint

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions