add test doc

This commit is contained in:
cmcmarrow 2023-04-17 14:02:39 -05:00 committed by Megan Wilhite
parent b4329fda8a
commit 78def957f0
2 changed files with 69 additions and 15 deletions

View file

@ -513,7 +513,7 @@ Now you can run your tests:
:: ::
python -m nox -e "test-3(coverage=False)" -- tests/unit/cli/test_batch.py python -m nox -e "test-3(coverage=False)" -- tests/unit/cli/test_batch.py
It's a good idea to install It's a good idea to install
`espeak <https://github.com/espeak-ng/espeak-ng>`__ or use ``say`` on `espeak <https://github.com/espeak-ng/espeak-ng>`__ or use ``say`` on
@ -522,28 +522,27 @@ this:
:: ::
python -m nox -e "test-3(coverage=False)" -- tests/unit/cli/test_batch.py; espeak "Tests done, woohoo!" python -m nox -e "test-3(coverage=False)" -- tests/unit/cli/test_batch.py; espeak "Tests done, woohoo!"
That way you don't have to keep monitoring the actual test run. That way you don't have to keep monitoring the actual test run.
:: ::
python -m nox -e "test-3(coverage=False)" -- --core-tests python -m nox -e "test-3(coverage=False)" -- --core-tests
You can enable or disable test groups locally by passing there respected flag: You can enable or disable test groups locally by passing their respected flag:
* "--no-fast-tests" - Tests that are ~10s or faster. * --no-fast-tests - Tests that are ~10s or faster. Fast tests make up ~75% of tests and can run in 10 to 20 minutes.
Fast tests make up ~75% of tests and can run in 10 to 20 minutes. * --slow-tests - Tests that are ~10s or slower.
* "--slow-tests" - Tests that are ~10s or slower. * --core-tests - Tests of any speed that test the root parts of salt.
* "--core-tests" - Tests of any speed that test the root parts of salt. * --flaky-jail - Test that need to be temporarily skipped.
* "--flaky-jail" - Test that need to be temporarily skipped.
In Your PR you can enable or disable test groups by setting a label. In Your PR, you can enable or disable test groups by setting a label.
All thought the fast, slow and core tests specified in the change file will always run. All thought the fast, slow, and core tests specified in the change file will always run.
* 'test:no-fast" * test:no-fast
* "test:core" * test:core
* "test:slow" * test:slow
* "test:flaky-jail" * test:flaky-jail
Changelog and commit! Changelog and commit!

View file

@ -452,6 +452,61 @@ can be used
) )
Test Groups
===========
Salt has four groups
* fast - Tests that are ~10s or faster. Fast tests make up ~75% of tests and can run in 10 to 20 minutes.
* core - Tests that are ~10s or slower.
* slow - Tests of any speed that test the root parts of salt.
* flaky-jail - Test that need to be temporarily skipped.
Pytest Decorators
* @pytest.mark.slow_test
* @pytest.mark.core_test
* @pytest.mark.flaky_jail
.. code-block:: python
@pytest.mark.core_test
def test_ping(self):
"""
test.ping
"""
self.assertTrue(self.run_function("test.ping"))
You can also mark all the tests in file.
.. code-block:: python
pytestmark = [pytest.mark.core_test]
def test_ping(self):
"""
test.ping
"""
self.assertTrue(self.run_function("test.ping"))
def test_ping2(self):
"""
test.ping
"""
for _ in range(10):
self.assertTrue(self.run_function("test.ping"))
You can enable or disable test groups locally by passing there respected flag:
* --no-fast-tests
* --slow-tests
* --core-tests
* --flaky-jail
In Your PR you can enable or disable test groups by setting a label.
All thought the fast, slow and core tests specified in the change file will always run.
* test:no-fast
* test:slow
* test:core
* test:flaky-jail
Automated Test Runs Automated Test Runs
=================== ===================