From d7493ad07d3d1bb90f577216f56afb321f3d6485 Mon Sep 17 00:00:00 2001 From: Nuwan Goonasekera <2070605+nuwang@users.noreply.github.com> Date: Wed, 14 Dec 2022 11:36:59 +0530 Subject: [PATCH 1/2] Reenable resubmit integration tests --- requirements_test.txt | 1 + tests/test_mapper_resubmit.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/requirements_test.txt b/requirements_test.txt index fdb4ef8..e340b80 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -12,6 +12,7 @@ galaxy-tool-util galaxy-web-stack galaxy-config galaxy-web-framework +celery[pytest] # required for the resubmission tests -e ".[test]" # The following packages are needed for resubmit integration testing (except galaxy-app) galaxy-job-execution diff --git a/tests/test_mapper_resubmit.py b/tests/test_mapper_resubmit.py index bc5a667..07e1fdb 100644 --- a/tests/test_mapper_resubmit.py +++ b/tests/test_mapper_resubmit.py @@ -32,8 +32,8 @@ def _assert_job_fails(self, tool_id="exit_code_oom", resource_parameters=None): assert exception_thrown # FIXME: Temporarily disable tests till https://github.com/galaxyproject/galaxy/issues/14021 is resolved. - # def test_mapping_with_resubmission(self): - # self._assert_job_passes(tool_id="exit_code_oom_with_resubmit") - # - # def test_mapping_without_resubmission(self): - # self._assert_job_fails(tool_id="exit_code_oom_no_resubmit") + def test_mapping_with_resubmission(self): + self._assert_job_passes(tool_id="exit_code_oom_with_resubmit") + + def test_mapping_without_resubmission(self): + self._assert_job_fails(tool_id="exit_code_oom_no_resubmit") From 3e53fdba830e637068cb2007e3ff1c9178ae9a33 Mon Sep 17 00:00:00 2001 From: Nuwan Goonasekera <2070605+nuwang@users.noreply.github.com> Date: Wed, 14 Dec 2022 11:37:54 +0530 Subject: [PATCH 2/2] Add pytest config to run slow tests optionally --- .github/workflows/tests.yaml | 2 +- requirements_test.txt | 2 +- tests/conftest.py | 21 +++++++++++++++++++++ tests/test_mapper_resubmit.py | 6 +++++- 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 tests/conftest.py diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index eb72fd8..7091237 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -81,7 +81,7 @@ jobs: run: pip install tox - name: Run tox - run: tox -e py${{ matrix.python-version }} + run: tox -e py${{ matrix.python-version }} -- --runslow env: PYTHONUNBUFFERED: "True" diff --git a/requirements_test.txt b/requirements_test.txt index e340b80..bda4a72 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -12,7 +12,7 @@ galaxy-tool-util galaxy-web-stack galaxy-config galaxy-web-framework -celery[pytest] # required for the resubmission tests +pytest-celery # required for the resubmission tests -e ".[test]" # The following packages are needed for resubmit integration testing (except galaxy-app) galaxy-job-execution diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..e446d0a --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,21 @@ +import pytest + + +def pytest_addoption(parser): + parser.addoption( + "--runslow", action="store_true", default=False, help="run slow tests" + ) + + +def pytest_configure(config): + config.addinivalue_line("markers", "slow: mark test as slow to run") + + +def pytest_collection_modifyitems(config, items): + if config.getoption("--runslow"): + # --runslow given in cli: do not skip slow tests + return + skip_slow = pytest.mark.skip(reason="need --runslow option to run") + for item in items: + if "slow" in item.keywords: + item.add_marker(skip_slow) diff --git a/tests/test_mapper_resubmit.py b/tests/test_mapper_resubmit.py index 07e1fdb..9af20af 100644 --- a/tests/test_mapper_resubmit.py +++ b/tests/test_mapper_resubmit.py @@ -1,4 +1,7 @@ import os + +import pytest + from galaxy_test.driver.integration_util import IntegrationTestCase from galaxy.webapps.base import webapp @@ -31,9 +34,10 @@ def _assert_job_fails(self, tool_id="exit_code_oom", resource_parameters=None): assert exception_thrown - # FIXME: Temporarily disable tests till https://github.com/galaxyproject/galaxy/issues/14021 is resolved. + @pytest.mark.slow def test_mapping_with_resubmission(self): self._assert_job_passes(tool_id="exit_code_oom_with_resubmit") + @pytest.mark.slow def test_mapping_without_resubmission(self): self._assert_job_fails(tool_id="exit_code_oom_no_resubmit")