From c8f202f27d0f8967f667fef4a6e8a0f895f1f784 Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 28 Jul 2023 15:02:59 -0400 Subject: [PATCH] re-add quick check for alternative engineering database test The test_environmental test when not run on the vpn will fail to contact the alternative engineering database server. This results in the test taking ~10 minutes waiting for a response before turning into a skip. This commit adds some lines of code that were removed in PR #3022 which changed the skip from a decorator to a pytest.skip when the exception/timeout occurs. This should allow the test to skip quickly when the host is not accessable (and instead skips in <1 second). The pytest.skip call during the except block is left to deal with cases when the host resolves but the url fails to resolve. --- CHANGES.rst | 6 ++++++ jwst/lib/tests/test_engdb_tools.py | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index cf2e98f52a..08f4eb1d84 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -24,6 +24,12 @@ datamodels - Remove ``jwst.datamodels.schema`` in favor of ``stdatamodels.schema`` [#7660] +engdb_tools +----------- + +- Check alternative host is alive before attempting to run test for + access to avoid waiting the full timeout during test runs [#7780] + flat_field ---------- diff --git a/jwst/lib/tests/test_engdb_tools.py b/jwst/lib/tests/test_engdb_tools.py index aae10c36bf..a28b3fed47 100644 --- a/jwst/lib/tests/test_engdb_tools.py +++ b/jwst/lib/tests/test_engdb_tools.py @@ -62,6 +62,10 @@ def engdb(): yield engdb +@pytest.mark.skipif( + not is_alive(ALTERNATE_HOST), + reason='Alternate test host not available.' +) def test_environmental(jail_environ): os.environ['ENG_BASE_URL'] = ALTERNATE_URL try: