Skip to content

Commit

Permalink
Add pytest config to run slow tests optionally
Browse files Browse the repository at this point in the history
  • Loading branch information
nuwang committed Nov 14, 2023
1 parent d7493ad commit 3e53fdb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 5 additions & 1 deletion tests/test_mapper_resubmit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import os

import pytest

from galaxy_test.driver.integration_util import IntegrationTestCase
from galaxy.webapps.base import webapp

Expand Down Expand Up @@ -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")

0 comments on commit 3e53fdb

Please sign in to comment.