diff --git a/tests/conftest.py b/tests/conftest.py index 9d673a3092c9..c9e10f93a198 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -16,6 +16,7 @@ import _pytest.skipping import more_itertools import pytest +import pytestskipmarkers import salt import salt._logging @@ -426,7 +427,8 @@ def pytest_itemcollected(item): pytest.fail( "The test {!r} appears to be written for pytest but it's not under" " {!r}. Please move it there.".format( - item.nodeid, str(PYTESTS_DIR.relative_to(CODE_DIR)), pytrace=False + item.nodeid, + str(PYTESTS_DIR.relative_to(CODE_DIR)), ) ) @@ -801,6 +803,12 @@ def salt_factories_default_root_dir(salt_factories_default_root_dir): dictionary, then that's the value used, and not the one returned by this fixture. """ + if os.environ.get("CI") and pytestskipmarkers.utils.platform.is_windows(): + tempdir = pathlib.Path( + os.environ.get("RUNNER_TEMP", r"C:\Windows\Temp") + ).resolve() + return tempdir / "stsuite" + return salt_factories_default_root_dir / "stsuite" diff --git a/tests/filename_map.yml b/tests/filename_map.yml index e561f627cfd4..3a70b1bd4e1f 100644 --- a/tests/filename_map.yml +++ b/tests/filename_map.yml @@ -155,7 +155,7 @@ salt/engines/*: - pytests.unit.engines.test_engines salt/grains/*: - - integration.grains.test_custom + - pytests.integration.grains.test_custom salt/matchers/*: - integration.states.test_match diff --git a/tests/integration/grains/test_custom.py b/tests/integration/grains/test_custom.py deleted file mode 100644 index d99e88d19020..000000000000 --- a/tests/integration/grains/test_custom.py +++ /dev/null @@ -1,23 +0,0 @@ -""" -Test the core grains -""" - -import pytest - -from tests.support.case import ModuleCase - - -@pytest.mark.windows_whitelisted -class TestGrainsCore(ModuleCase): - """ - Test the core grains grains - """ - - @pytest.mark.slow_test - def test_grains_passed_to_custom_grain(self): - """ - test if current grains are passed to grains module functions that have a grains argument - """ - self.assertEqual( - self.run_function("grains.get", ["custom_grain_test"]), "itworked" - ) diff --git a/tests/pytests/integration/grains/test_custom.py b/tests/pytests/integration/grains/test_custom.py new file mode 100644 index 000000000000..6eeab4deab12 --- /dev/null +++ b/tests/pytests/integration/grains/test_custom.py @@ -0,0 +1,20 @@ +""" +Test the custom grains +""" + +import pytest + +pytestmark = [ + pytest.mark.windows_whitelisted, + pytest.mark.slow_test, +] + + +def test_grains_passed_to_custom_grain(salt_call_cli): + """ + test if current grains are passed to grains module functions that have a grains argument + """ + ret = salt_call_cli.run("grains.item", "custom_grain_test") + assert ret.returncode == 0 + assert ret.data + assert ret.data["custom_grain_test"] == "itworked"