Skip to content

Commit ed6a1eb

Browse files
committed
introduce strict endpoints test to test availability of endpoints
1 parent e3e6721 commit ed6a1eb

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ jobs:
165165
SQLALCHEMY_WARN_20: 1
166166
continue-on-error: true
167167
run: |
168-
py.test -vv tests/*_test.py tests/test_*.py -m "endpoints_test" || echo "::warning ::At least one analyses endpoint was not available"
168+
py.test -vv tests/*_test.py tests/test_*.py -m "strict_endpoints_test" || echo "::warning ::At least one analyses endpoint was not available"
169169
- name: Setup Sauce Connect
170170
uses: saucelabs/sauce-connect-action@v3.0.0
171171
if: startsWith(matrix.python-version, '3.9')

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
addopts = --ignore=docs --cov=hepdata --cov-report=term-missing --cov-config=.coveragerc --live-server-port=5555
2727
timeout = 300
2828
markers =
29-
endpoints_test: tests analyses endpoints (which might have HEPData-unrelated issues, deselect with '-m "not endpoints_test"')
29+
strict_endpoints_test: tests analyses endpoints, raising errors (which might have HEPData-unrelated issues, deselect with '-m "not strict_endpoints_test"')

tests/records_test.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ def update_analyses_single_tool_forgiving(tool):
10441044
update_analyses_single_tool(tool)
10451045
except (jsonschema.exceptions.ValidationError, LookupError) as e:
10461046
# syntax ensures flagging by GitHub CI
1047-
raise Warning(f"WARNING: test_update_analyses[{tool}] failed with '{e}' which indicates error on tool side. Skipping test.")
1047+
print(f"WARNING: test_update_analyses[{tool}] failed with '{e}' which indicates error on tool side. Skipping test.")
10481048
return False
10491049
return True
10501050

@@ -1082,7 +1082,16 @@ def test_update_analyses(app, tool, import_id, counts, test_user, url, license):
10821082
assert is_current_user_subscribed_to_record(submission.publication_recid, user)
10831083

10841084

1085-
@pytest.mark.endpoints_test
1085+
testdata_analyses_pytest_strict = list(testdata_analyses.keys())+["TestAnalysis"]
1086+
@pytest.mark.strict_endpoints_test
1087+
@pytest.mark.parametrize("tool", testdata_analyses_pytest_strict)
1088+
def test_update_analyses_strict(app, tool):
1089+
""" Test update of Rivet, MadAnalyses 5, etc. analyses
1090+
Be strict about encountered errors, i.e. flag even if error is (presumably) on tool side
1091+
"""
1092+
update_analyses_single_tool(tool)
1093+
1094+
10861095
def test_multiupdate_analyses(app):
10871096
""" Test update of analyses multiple times, using Rivet as example """
10881097
# Import a record that already has a Rivet analysis attached (but with '#' in the URL)
@@ -1106,7 +1115,6 @@ def test_multiupdate_analyses(app):
11061115
assert analysis_resources[0].file_location == 'http://rivet.hepforge.org/analyses/ATLAS_2012_I1203852'
11071116

11081117

1109-
@pytest.mark.endpoints_test
11101118
def test_update_delete_analyses(app):
11111119
""" Test update and deleting of analyses, using Combine as example """
11121120
# Import a record that has an associated Combine analysis
@@ -1137,7 +1145,6 @@ def assert_err_msg(err_type, expected_msg, truncate_length=None):
11371145
assert err_msg == expected_msg
11381146

11391147

1140-
@pytest.mark.endpoints_test
11411148
def test_incorrect_endpoint(app):
11421149
""" Test update_analyses with incorrect endpoint configurations """
11431150
# Call update_analyses_single_tool using an endpoint with no endpoint_url

0 commit comments

Comments
 (0)