From c2adbf221fe38bc9624ead44615a57d79eec9baf Mon Sep 17 00:00:00 2001 From: Alexander Cristurean Date: Tue, 5 Nov 2024 11:26:10 +0200 Subject: [PATCH] fix skip_on_windows marker --- .github/workflows/build-windows.yml | 2 +- .github/workflows/test-localnet-tests.yml | 2 +- multiversx_sdk_cli/tests/conftest.py | 4 +--- multiversx_sdk_cli/tests/test_cli_deps.py | 4 ++-- pytest.ini | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index ae33b14e..e7010de2 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -47,7 +47,7 @@ jobs: shell: bash run: | export PYTHONPATH=. - pytest -m "run_on_windows" . + pytest -m "not skip_on_windows" . - name: Run CLI tests shell: bash run: | diff --git a/.github/workflows/test-localnet-tests.yml b/.github/workflows/test-localnet-tests.yml index e4b66985..c79969c9 100644 --- a/.github/workflows/test-localnet-tests.yml +++ b/.github/workflows/test-localnet-tests.yml @@ -51,5 +51,5 @@ jobs: - name: Test localnet dependent tests run: | - pytest -m require_localnet multiversx_sdk_cli/tests + pytest -m require_localnet . diff --git a/multiversx_sdk_cli/tests/conftest.py b/multiversx_sdk_cli/tests/conftest.py index 2939fe5e..abff81f5 100644 --- a/multiversx_sdk_cli/tests/conftest.py +++ b/multiversx_sdk_cli/tests/conftest.py @@ -4,9 +4,7 @@ # function executed right after test items collected but before test run def pytest_collection_modifyitems(config, items): if not config.getoption('-m'): - skip_me = pytest.mark.skip(reason="to run marked tests, you need to explicitly run them with -m") + skip_me = pytest.mark.skip(reason="require_localnet will only run if explicitly set to with -m") for item in items: if "require_localnet" in item.keywords: item.add_marker(skip_me) - if "run_on_windows" in item.keywords: - item.add_marker(skip_me) diff --git a/multiversx_sdk_cli/tests/test_cli_deps.py b/multiversx_sdk_cli/tests/test_cli_deps.py index 1d57bbf5..63162d71 100644 --- a/multiversx_sdk_cli/tests/test_cli_deps.py +++ b/multiversx_sdk_cli/tests/test_cli_deps.py @@ -41,13 +41,13 @@ def test_deps_check_testwallets(): assert return_code == 0 -@pytest.mark.run_on_windows +@pytest.mark.skip_on_windows def test_deps_install_all(): return_code = main(["deps", "install", "all"]) assert return_code == 0 -@pytest.mark.run_on_windows +@pytest.mark.skip_on_windows def test_deps_check_all(): return_code = main(["deps", "check", "all"]) assert return_code == 0 diff --git a/pytest.ini b/pytest.ini index f1722316..4cee0be1 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] markers = - run_on_windows: marks tests as being skipped when running on windows (select with '-m "run_on_windows"') + skip_on_windows: marks tests as being skipped when running on windows (deselect with '-m "skip_on_windows"') only: only run a specific test (run using: pytest -m "only") require_localnet: marks tests that require a localnet (select with '-m "require_localnet"')