diff --git a/.circleci/config.yml b/.circleci/config.yml index 1a50c75b..38877b70 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -83,7 +83,7 @@ orbs: steps: - run: no_output_timeout: 1.5h - command: tox -e <> <> + command: DS_RUN_SLOW_TESTS=true tox -e <> <> tox_post: steps: diff --git a/tests/conftest.py b/tests/conftest.py index 11938c8b..118357fc 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,4 @@ +import os from pathlib import Path from logbook import StderrHandler @@ -6,6 +7,7 @@ from disc_solver.solve import solve from disc_solver.float_handling import float_type as FLOAT_TYPE +from disc_solver.utils import str_to_bool PLOT_FILE = "plot.png" @@ -49,6 +51,7 @@ USE_E_R_SOLUTIONS = [ "mod_hydro_solution_use_E_r", ] + NON_APPROX_SOLUTIONS = [ "single_solution_default", "sonic_root_solution_default", @@ -57,6 +60,25 @@ "sonic_root_solution_no_internal", ] +CAN_BE_SKIPPED = { + "hydrostatic_solution_default", + "hydrostatic_solution_no_internal", + "mcmc_solution_no_internal", + "mod_hydro_solution_default", + "mod_hydro_solution_no_internal", + "mod_hydro_solution_use_E_r", + "sonic_root_solution_default", + "sonic_root_solution_no_internal", +} + + +@pytest.fixture(scope="session") +def skip_slow_tests(): + dont_skip = os.environ.get("DS_RUN_SLOW_TESTS") + if dont_skip is None: + return True + return str_to_bool(dont_skip) + @pytest.fixture(scope="session") def single_solution_default(tmpdir_factory): @@ -181,37 +203,65 @@ def mod_hydro_solution_use_E_r(tmpdir_factory): @pytest.fixture(scope="session", params=ALL_SOLUTIONS) -def solution(request): +def solution(request, skip_slow_tests): + if skip_slow_tests and request.param in CAN_BE_SKIPPED: + pytest.skip( + "Skipping as {} in skipable solutions".format(request.param) + ) return request.getfixturevalue(request.param) @pytest.fixture(scope="session", params=DEFAULT_SOLUTIONS) def solution_default(request): + if skip_slow_tests and request.param in CAN_BE_SKIPPED: + pytest.skip( + "Skipping as {} in skipable solutions".format(request.param) + ) return request.getfixturevalue(request.param) @pytest.fixture(scope="session", params=NO_INTERNAL_SOLUTIONS) def solution_no_internal(request): + if skip_slow_tests and request.param in CAN_BE_SKIPPED: + pytest.skip( + "Skipping as {} in skipable solutions".format(request.param) + ) return request.getfixturevalue(request.param) @pytest.fixture(scope="session", params=MULTI_SOLUTIONS) def solutions_many(request): + if skip_slow_tests and request.param in CAN_BE_SKIPPED: + pytest.skip( + "Skipping as {} in skipable solutions".format(request.param) + ) return request.getfixturevalue(request.param) @pytest.fixture(scope="session", params=TAYLOR_SOLUTIONS) def solution_taylor(request): + if skip_slow_tests and request.param in CAN_BE_SKIPPED: + pytest.skip( + "Skipping as {} in skipable solutions".format(request.param) + ) return request.getfixturevalue(request.param) @pytest.fixture(scope="session", params=DERIV_SOLUTIONS) def solution_deriv(request): + if skip_slow_tests and request.param in CAN_BE_SKIPPED: + pytest.skip( + "Skipping as {} in skipable solutions".format(request.param) + ) return request.getfixturevalue(request.param) @pytest.fixture(scope="session", params=DERIV_NO_INTERNAL_SOLUTIONS) def solution_deriv_no_internal(request): + if skip_slow_tests and request.param in CAN_BE_SKIPPED: + pytest.skip( + "Skipping as {} in skipable solutions".format(request.param) + ) return request.getfixturevalue(request.param)