Skip to content

Commit

Permalink
minor: backwards compatibility with py38
Browse files Browse the repository at this point in the history
  • Loading branch information
cwacek committed Nov 12, 2024
1 parent e8cb21a commit 55cab3d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@

@pytest.fixture
def markdown_examples():
with importlib.resources.as_file(
importlib.resources.files("python_jsonschema_objects.examples") / "README.md"
) as md:
if hasattr(importlib.resources, "as_file"):
filehandle = importlib.resources.as_file(
importlib.resources.files("python_jsonschema_objects.examples")
/ "README.md"
)
else:
filehandle = importlib.resources.path(
"python_jsonschema_objects.examples", "README.md"
)
with filehandle as md:
examples = pjs.markdown_support.extract_code_blocks(md)

return {json.loads(v)["title"]: json.loads(v) for v in examples["schema"]}
Expand Down

0 comments on commit 55cab3d

Please sign in to comment.