Skip to content

Commit

Permalink
Avoid using DLite for Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperWA committed Nov 22, 2023
1 parent 049df21 commit c5d5742
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Natural Language :: English",
"Operating System :: OS Independent",
"Private :: Do Not Upload",
]
keywords = ["dlite", "mongodb"]
requires-python = "~=3.10"
Expand All @@ -37,7 +36,7 @@ dependencies = [

[project.optional-dependencies]
testing = [
"dlite-python >=0.4.5,<1",
"dlite-python >=0.4.5,<1; python_version < '3.12'",
"httpx >=0.25.1,<1",
"mongomock ~=4.1",
"pytest ~=7.4",
Expand Down
9 changes: 7 additions & 2 deletions tests/test_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ def test_get_entity(
client: TestClient,
) -> None:
"""Test the route to retrieve a DLite/SOFT entity."""
import sys

import yaml
from dlite import Instance
from fastapi import status

entities: list[dict[str, Any]] = yaml.safe_load(
Expand All @@ -40,7 +41,11 @@ def test_get_entity(
assert (resolved_entity := response.json()) == entity, resolved_entity

# Validate that we can instantiate an Instance from the response
Instance.from_dict(resolved_entity)
# DLite does not support Python 3.12 yet.
if sys.version_info < (3, 12):
from dlite import Instance

Instance.from_dict(resolved_entity)


def test_get_entity_not_found(client: TestClient) -> None:
Expand Down

0 comments on commit c5d5742

Please sign in to comment.