diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a7a9980..6c704ee 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,5 +30,4 @@ jobs: - name: Run Pytest run: | - export PYTHONPATH=src:$PYTHONPATH pytest diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..cc4ec91 --- /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) \ No newline at end of file diff --git a/tests/test_vip_utils.py b/tests/test_vip_utils.py index 683ec04..b8639b8 100644 --- a/tests/test_vip_utils.py +++ b/tests/test_vip_utils.py @@ -27,6 +27,7 @@ def setup_teardown_vip_launcher(): yield assert delete_path(BASE_PATH_VIP) +@pytest.mark.slow def test_upload_download(): assert upload(BASE_PATH_LOCAL + 'file.txt', BASE_PATH_VIP + 'file.txt') assert exists(BASE_PATH_VIP + 'file.txt') @@ -34,7 +35,7 @@ def test_upload_download(): assert compare_files(BASE_PATH_LOCAL + 'file.txt', BASE_PATH_LOCAL + 'file_copy.txt') assert delete_path(BASE_PATH_VIP + 'file.txt') - +@pytest.mark.slow def test_init_exec(): input_values = { 'mand_text': 'value1', @@ -44,7 +45,7 @@ def test_init_exec(): exec_info = execution_info(exec_id) assert exec_info['status'] == 'Running' - +@pytest.mark.slow def test_kill_exec(): input_values = { 'mand_text': 'value1', @@ -65,6 +66,7 @@ def test_kill_exec(): if counter > 100: raise Exception("Execution not ended after delay") +@pytest.mark.slow def test_get_exec_stdout(): input_values = { 'mand_text': 'value1', @@ -80,7 +82,7 @@ def test_get_exec_stdout(): stdout = get_exec_stdout(exec_id) assert isinstance(stdout, str) - +@pytest.mark.slow def test_get_exec_results(): input_values = { 'mand_text': 'value1', @@ -101,7 +103,7 @@ def test_get_exec_results(): assert 'executionId' in r assert 'path' in r - +@pytest.mark.slow def test_list_pipeline(): pipelines = list_pipeline() # assert that this is a list of dictionaries @@ -115,7 +117,7 @@ def test_list_pipeline(): assert 'canExecute' in p assert 'description' in p - +@pytest.mark.slow def test_pipeline_def(): pipeline = pipeline_def('CQUEST/0.3') assert isinstance(pipeline, dict) @@ -126,7 +128,7 @@ def test_pipeline_def(): assert 'canExecute' in pipeline assert 'description' in pipeline - +@pytest.mark.slow def test_platform_info(): info = platform_info() assert isinstance(info, dict)