diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index f1e1e2d6607..9f96a1f5b37 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -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 `espeak `__ 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. :: - 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: - * "--no-fast-tests" - Tests that are ~10s or faster. - Fast tests make up ~75% of tests and can run in 10 to 20 minutes. - * "--slow-tests" - Tests that are ~10s or slower. - * "--core-tests" - Tests of any speed that test the root parts of salt. - * "--flaky-jail" - Test that need to be temporarily skipped. +You can enable or disable test groups locally by passing their respected flag: +* --no-fast-tests - Tests that are ~10s or faster. Fast tests make up ~75% of tests and can run in 10 to 20 minutes. +* --slow-tests - Tests that are ~10s or slower. +* --core-tests - Tests of any speed that test the root parts of salt. +* --flaky-jail - Test that need to be temporarily skipped. -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:core" - * "test:slow" - * "test: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:core +* test:slow +* test:flaky-jail Changelog and commit! diff --git a/doc/topics/tutorials/writing_tests.rst b/doc/topics/tutorials/writing_tests.rst index c7dc82069d3..2d8c6beb99b 100644 --- a/doc/topics/tutorials/writing_tests.rst +++ b/doc/topics/tutorials/writing_tests.rst @@ -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 ===================