Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
setuptools~=78.1.0
antlr4-python3-runtime==4.9.3
10 changes: 8 additions & 2 deletions test_schemas.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Tests to test wikidata entityschemas against wikidata items
"""
import time
import unittest

import requests
Expand All @@ -15,11 +16,12 @@

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):
"""
Expand Down Expand Up @@ -73,8 +75,12 @@
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")

Check warning on line 83 in test_schemas.py

View check run for this annotation

Codecov / codecov/patch

test_schemas.py#L83

Added line #L83 was not covered by tests
self.assertEqual(response.status_code, 200)

def test_specific_entityschema(self) -> None:
Expand Down
Loading