Skip to content

Commit 529b57a

Browse files
committed
Bump the minimum jsonschema-specifications/rpds versions to avoid #1059
This should re-enable validating from a thread other than the one that originall imported jsonschema.
1 parent abc4fcf commit 529b57a

File tree

3 files changed

+39
-11
lines changed

3 files changed

+39
-11
lines changed

docs/requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ attrs==22.2.0
1414
# referencing
1515
babel==2.12.1
1616
# via sphinx
17-
beautifulsoup4==4.11.2
17+
beautifulsoup4==4.12.0
1818
# via furo
1919
certifi==2022.12.7
2020
# via requests
@@ -26,7 +26,7 @@ cycler==0.11.0
2626
# via matplotlib
2727
docutils==0.19
2828
# via sphinx
29-
fonttools==4.39.0
29+
fonttools==4.39.2
3030
# via matplotlib
3131
furo==2022.12.7
3232
# via -r docs/requirements.in
@@ -40,7 +40,7 @@ jinja2==3.1.2
4040
# sphinx-autoapi
4141
file:.#egg=jsonschema
4242
# via -r docs/requirements.in
43-
jsonschema-specifications==2023.3.4
43+
jsonschema-specifications==2023.3.5
4444
# via jsonschema
4545
kiwisolver==1.4.4
4646
# via matplotlib
@@ -76,13 +76,13 @@ python-dateutil==2.8.2
7676
# via matplotlib
7777
pyyaml==6.0
7878
# via sphinx-autoapi
79-
referencing==0.24.4
79+
referencing==0.25.0
8080
# via
8181
# jsonschema
8282
# jsonschema-specifications
8383
requests==2.28.2
8484
# via sphinx
85-
rpds-py==0.6.1
85+
rpds-py==0.7.0
8686
# via
8787
# jsonschema
8888
# referencing

jsonschema/tests/test_validators.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,6 +2115,37 @@ def test_it_uses_best_match(self):
21152115
self.assertIn("12 is less than the minimum of 20", str(e.exception))
21162116

21172117

2118+
class TestThreading(TestCase):
2119+
"""
2120+
Threading-related functionality tests.
2121+
2122+
jsonschema doesn't promise thread safety, and its validation behavior
2123+
across multiple threads may change at any time, but that means it isn't
2124+
safe to share *validators* across threads, not that anytime one has
2125+
multiple threads that jsonschema won't work (it certainly is intended to).
2126+
2127+
These tests ensure that this minimal level of functionality continues to
2128+
work.
2129+
"""
2130+
2131+
def test_validation_across_a_second_thread(self):
2132+
failed = []
2133+
2134+
def validate():
2135+
try:
2136+
validators.validate(instance=37, schema=True)
2137+
except: # noqa: E722, pragma: no cover
2138+
failed.append(sys.exc_info())
2139+
2140+
validate() # just verify it succeeds
2141+
2142+
from threading import Thread
2143+
thread = Thread(target=validate)
2144+
thread.start()
2145+
thread.join()
2146+
self.assertEqual((thread.is_alive(), failed), (False, []))
2147+
2148+
21182149
class TestRefResolver(TestCase):
21192150

21202151
base_uri = ""

pyproject.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@ dynamic = ["version", "readme"]
3232

3333
dependencies = [
3434
"attrs>=22.2.0",
35-
"jsonschema-specifications>=2023.03.4",
36-
"referencing>=0.24.4",
37-
"rpds-py>=0.6.1",
38-
39-
"importlib_metadata;python_version<'3.8'",
40-
"typing_extensions;python_version<'3.8'",
35+
"jsonschema-specifications>=2023.03.5",
36+
"referencing>=0.25.0",
37+
"rpds-py>=0.7.0",
4138

4239
"importlib_resources>=1.4.0;python_version<'3.9'",
4340
"pkgutil_resolve_name>=1.3.10;python_version<'3.9'",

0 commit comments

Comments
 (0)