Skip to content
Snippets Groups Projects
Verified Commit 4cc8f12f authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

Delay import to allow proper debian packaging of the client code

The swh.graph.client and swh.graph.naive_client must be packaged separately to allow the
vault to use the optional graph dependency. We need the tests to run in the packaging
though. The current conftest.py mixes both server and client code though. Delaying
imports this way will allow the packaging to run accordingly [1].

[1]
```
pytest -k "not remote" swh/
```

Related to T3518
parent 424e75a9
No related branches found
No related tags found
No related merge requests found
......@@ -10,11 +10,8 @@ from pathlib import Path
from aiohttp.test_utils import TestClient, TestServer, loop_context
import pytest
from swh.graph.backend import Backend
from swh.graph.client import RemoteGraphClient
from swh.graph.graph import load as graph_load
from swh.graph.naive_client import NaiveClient
from swh.graph.server.app import make_app
SWH_GRAPH_TESTS_ROOT = Path(__file__).parents[0]
TEST_GRAPH_PATH = SWH_GRAPH_TESTS_ROOT / "dataset/output/example"
......@@ -26,6 +23,10 @@ class GraphServerProcess(multiprocessing.Process):
super().__init__(*args, **kwargs)
def run(self):
# Lazy import to allow debian packaging
from swh.graph.backend import Backend
from swh.graph.server.app import make_app
try:
backend = Backend(graph_path=str(TEST_GRAPH_PATH))
with loop_context() as loop:
......@@ -60,5 +61,8 @@ def graph_client(request):
@pytest.fixture(scope="module")
def graph():
# Lazy import to allow debian packaging
from swh.graph.graph import load as graph_load
with graph_load(str(TEST_GRAPH_PATH)) as g:
yield g
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment