From 073b4253c0d2487f72029c80e78fabbbdb9e2ce1 Mon Sep 17 00:00:00 2001 From: Matthew Gidden Date: Sat, 2 Nov 2019 09:36:06 +0100 Subject: [PATCH] update regression tests to succeed locally --- tests/test_regression.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_regression.py b/tests/test_regression.py index b81863f..9a87b34 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -20,6 +20,14 @@ here = join(os.path.dirname(os.path.realpath(__file__))) ci_path = join(here, 'ci') +# check variables for if we are on CI (will then run regression tests) +ON_CI_REASON = 'No access to regression test credentials' +try: + os.environ['ANERIS_CI_USER'] + ON_CI = True +except KeyError: + ON_CI = False + class TestHarmonizeRegression(): @@ -91,14 +99,14 @@ def _run_ci(self, name): self._run(inf, checkf, hist, reg, rc, outf, prefix) # only runs if access to regression data is available - @pytest.mark.skipif(not os.environ['ANERIS_CI_USER'], reason='No access to regression test credentials') + @pytest.mark.skipif(not ON_CI, reason=ON_CI_REASON) def test_msg(self): # file setup name = 'msg' self._run_ci(name) # only runs if access to regression data is available - @pytest.mark.skipif(not os.environ['ANERIS_CI_USER'], reason='No access to regression test credentials') + @pytest.mark.skipif(not ON_CI, reason=ON_CI_REASON) def test_gcam(self): # file setup name = 'gcam'