From 1ffeb331e8938c8422015486313569bf8bdefd72 Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 16 Apr 2025 10:49:55 +0100 Subject: [PATCH 1/2] Update requirements.txt --- requirements.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 802a333..a438298 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,8 @@ -flask~=3.0.3 -flask_cors~=4.0.1 +flask~=3.1.0 +flask_cors~=5.0.1 requests==2.32.3 PyShExC~=0.9.1 chardet~=5.2.0 jsonasobj~=1.3.1 -setuptools~=71.1.0 \ No newline at end of file +setuptools~=78.1.0 +antlr4-python3-runtime==4.9.3 From 0626ead4469a17763372098a0ad379f28a267685 Mon Sep 17 00:00:00 2001 From: Mark Tully Date: Wed, 16 Apr 2025 23:58:40 +0100 Subject: [PATCH 2/2] Add a wait between running tests which query Wikidata since it tends to throttle requests coming from Github Actions causing tests to fail. --- test_schemas.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test_schemas.py b/test_schemas.py index 00cebd3..ff5312e 100644 --- a/test_schemas.py +++ b/test_schemas.py @@ -1,6 +1,7 @@ """ Tests to test wikidata entityschemas against wikidata items """ +import time import unittest import requests @@ -15,11 +16,12 @@ class MyTestCase(unittest.TestCase): def setUp(self) -> None: app.config["TESTING"] = True + app.config['DEBUG'] = False self.app = app.test_client() def tearDown(self) -> None: - # We don't need to tear anything down after the test - pass + # Wait before performing the next test to avoid running into Wikidata's request limits when using Github Actions + time.sleep(4) def test_specific_wikidata_item_against_schema(self): """ @@ -73,8 +75,12 @@ def test_wikidata_entityschemas(self) -> None: with self.subTest(schema=schema): if schema in skips: self.skipTest(f"Schema {schema} not supported") + # Wait before performing the next test to avoid running into Wikidata's request limits when using Github Actions + time.sleep(4) response = self.app.get(f'/api/v2?entityschema={schema}&entity=Q100532807&language=en', follow_redirects=True) + if response.status_code == 429: + self.skipTest("Wikidata is giving a 429 (too many requests) response") self.assertEqual(response.status_code, 200) def test_specific_entityschema(self) -> None: