diff --git a/MANIFEST.in b/MANIFEST.in --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,3 +4,4 @@ include version.txt include README.md recursive-include swh py.typed +recursive-include swh/graph/tests/dataset * diff --git a/java/server/README.md b/java/server/README.md --- a/java/server/README.md +++ b/java/server/README.md @@ -27,7 +27,7 @@ ----- Unit tests rely on test data that are already available in the Git repository -(under `src/test/dataset/`). You generally only need to run them using Maven: +(under `src/swh/graph/tests/dataset/`). You generally only need to run them using Maven: ```bash $ mvn test @@ -37,14 +37,14 @@ ```bash # Graph compression -$ cd src/test/dataset +$ cd src/swh/graph/tests/dataset $ ./generate_graph.sh -$ cd ../../../ +$ cd ../../../.. $ mvn compile assembly:single # Dump mapping files $ java -cp target/swh-graph-jar-with-dependencies.jar \ org.softwareheritage.graph.backend.Setup \ - src/test/dataset/example.nodes.csv.gz \ - src/test/dataset/output/example + src/swh/graph/tests/dataset/example.nodes.csv.gz \ + src/swh/graph/tests/dataset/output/example ``` diff --git a/java/server/src/test/java/org/softwareheritage/graph/GraphTest.java b/java/server/src/test/java/org/softwareheritage/graph/GraphTest.java --- a/java/server/src/test/java/org/softwareheritage/graph/GraphTest.java +++ b/java/server/src/test/java/org/softwareheritage/graph/GraphTest.java @@ -20,7 +20,7 @@ @BeforeClass public static void setUp() throws IOException { - Path graphPath = Paths.get("..", "..", "tests", "dataset", "output", "example"); + Path graphPath = Paths.get("..", "..", "swh", "graph", "tests", "dataset", "output", "example"); graph = new Graph(graphPath.toString()); } diff --git a/swh/graph/tests/conftest.py b/swh/graph/tests/conftest.py --- a/swh/graph/tests/conftest.py +++ b/swh/graph/tests/conftest.py @@ -1,16 +1,16 @@ import multiprocessing import pytest -from pathlib import Path from aiohttp.test_utils import TestServer, TestClient, loop_context +from pathlib import Path from swh.graph.graph import load as graph_load from swh.graph.client import RemoteGraphClient from swh.graph.backend import Backend from swh.graph.server.app import make_app -SWH_GRAPH_ROOT = Path(__file__).parents[3] -TEST_GRAPH_PATH = SWH_GRAPH_ROOT / 'tests/dataset/output/example' +SWH_GRAPH_TESTS_ROOT = Path(__file__).parents[0] +TEST_GRAPH_PATH = SWH_GRAPH_TESTS_ROOT / 'dataset/output/example' class GraphServerProcess(multiprocessing.Process): diff --git a/tests/dataset/.gitignore b/swh/graph/tests/dataset/.gitignore rename from tests/dataset/.gitignore rename to swh/graph/tests/dataset/.gitignore diff --git a/tests/dataset/example.edges.csv b/swh/graph/tests/dataset/example.edges.csv rename from tests/dataset/example.edges.csv rename to swh/graph/tests/dataset/example.edges.csv diff --git a/tests/dataset/example.edges.csv.gz b/swh/graph/tests/dataset/example.edges.csv.gz rename from tests/dataset/example.edges.csv.gz rename to swh/graph/tests/dataset/example.edges.csv.gz diff --git a/tests/dataset/example.nodes.csv b/swh/graph/tests/dataset/example.nodes.csv rename from tests/dataset/example.nodes.csv rename to swh/graph/tests/dataset/example.nodes.csv diff --git a/tests/dataset/example.nodes.csv.gz b/swh/graph/tests/dataset/example.nodes.csv.gz rename from tests/dataset/example.nodes.csv.gz rename to swh/graph/tests/dataset/example.nodes.csv.gz diff --git a/tests/dataset/generate_graph.sh b/swh/graph/tests/dataset/generate_graph.sh rename from tests/dataset/generate_graph.sh rename to swh/graph/tests/dataset/generate_graph.sh diff --git a/tests/dataset/img/.gitignore b/swh/graph/tests/dataset/img/.gitignore rename from tests/dataset/img/.gitignore rename to swh/graph/tests/dataset/img/.gitignore diff --git a/tests/dataset/img/Makefile b/swh/graph/tests/dataset/img/Makefile rename from tests/dataset/img/Makefile rename to swh/graph/tests/dataset/img/Makefile diff --git a/tests/dataset/img/example.dot b/swh/graph/tests/dataset/img/example.dot rename from tests/dataset/img/example.dot rename to swh/graph/tests/dataset/img/example.dot diff --git a/tests/dataset/output/example-transposed.graph b/swh/graph/tests/dataset/output/example-transposed.graph rename from tests/dataset/output/example-transposed.graph rename to swh/graph/tests/dataset/output/example-transposed.graph diff --git a/tests/dataset/output/example-transposed.obl b/swh/graph/tests/dataset/output/example-transposed.obl rename from tests/dataset/output/example-transposed.obl rename to swh/graph/tests/dataset/output/example-transposed.obl diff --git a/tests/dataset/output/example-transposed.offsets b/swh/graph/tests/dataset/output/example-transposed.offsets rename from tests/dataset/output/example-transposed.offsets rename to swh/graph/tests/dataset/output/example-transposed.offsets diff --git a/tests/dataset/output/example-transposed.properties b/swh/graph/tests/dataset/output/example-transposed.properties rename from tests/dataset/output/example-transposed.properties rename to swh/graph/tests/dataset/output/example-transposed.properties diff --git a/tests/dataset/output/example.graph b/swh/graph/tests/dataset/output/example.graph rename from tests/dataset/output/example.graph rename to swh/graph/tests/dataset/output/example.graph diff --git a/tests/dataset/output/example.indegree b/swh/graph/tests/dataset/output/example.indegree rename from tests/dataset/output/example.indegree rename to swh/graph/tests/dataset/output/example.indegree diff --git a/tests/dataset/output/example.mph b/swh/graph/tests/dataset/output/example.mph rename from tests/dataset/output/example.mph rename to swh/graph/tests/dataset/output/example.mph diff --git a/tests/dataset/output/example.node2pid.bin b/swh/graph/tests/dataset/output/example.node2pid.bin rename from tests/dataset/output/example.node2pid.bin rename to swh/graph/tests/dataset/output/example.node2pid.bin diff --git a/tests/dataset/output/example.node2pid.csv b/swh/graph/tests/dataset/output/example.node2pid.csv rename from tests/dataset/output/example.node2pid.csv rename to swh/graph/tests/dataset/output/example.node2pid.csv diff --git a/tests/dataset/output/example.node2type.map b/swh/graph/tests/dataset/output/example.node2type.map rename from tests/dataset/output/example.node2type.map rename to swh/graph/tests/dataset/output/example.node2type.map diff --git a/tests/dataset/output/example.obl b/swh/graph/tests/dataset/output/example.obl rename from tests/dataset/output/example.obl rename to swh/graph/tests/dataset/output/example.obl diff --git a/tests/dataset/output/example.offsets b/swh/graph/tests/dataset/output/example.offsets rename from tests/dataset/output/example.offsets rename to swh/graph/tests/dataset/output/example.offsets diff --git a/tests/dataset/output/example.order b/swh/graph/tests/dataset/output/example.order rename from tests/dataset/output/example.order rename to swh/graph/tests/dataset/output/example.order diff --git a/tests/dataset/output/example.outdegree b/swh/graph/tests/dataset/output/example.outdegree rename from tests/dataset/output/example.outdegree rename to swh/graph/tests/dataset/output/example.outdegree diff --git a/tests/dataset/output/example.pid2node.bin b/swh/graph/tests/dataset/output/example.pid2node.bin rename from tests/dataset/output/example.pid2node.bin rename to swh/graph/tests/dataset/output/example.pid2node.bin diff --git a/tests/dataset/output/example.pid2node.csv b/swh/graph/tests/dataset/output/example.pid2node.csv rename from tests/dataset/output/example.pid2node.csv rename to swh/graph/tests/dataset/output/example.pid2node.csv diff --git a/tests/dataset/output/example.properties b/swh/graph/tests/dataset/output/example.properties rename from tests/dataset/output/example.properties rename to swh/graph/tests/dataset/output/example.properties diff --git a/tests/dataset/output/example.stats b/swh/graph/tests/dataset/output/example.stats rename from tests/dataset/output/example.stats rename to swh/graph/tests/dataset/output/example.stats diff --git a/swh/graph/tests/test_api_client.py b/swh/graph/tests/test_api_client.py --- a/swh/graph/tests/test_api_client.py +++ b/swh/graph/tests/test_api_client.py @@ -1,10 +1,3 @@ -import os -import pytest - - -pytestmark = pytest.mark.skipif(os.environ.get('JENKINS'), reason='T2055') - - def test_stats(graph_client): stats = graph_client.stats() @@ -112,7 +105,6 @@ def test_count(graph_client): - print(graph_client) actual = graph_client.count_leaves( 'swh:1:ori:0000000000000000000000000000000000000021' ) diff --git a/swh/graph/tests/test_cli.py b/swh/graph/tests/test_cli.py --- a/swh/graph/tests/test_cli.py +++ b/swh/graph/tests/test_cli.py @@ -11,8 +11,6 @@ from click.testing import CliRunner -import swh.graph - from swh.graph import cli @@ -31,8 +29,7 @@ class TestCompress(unittest.TestCase): - DATA_DIR = Path(swh.graph.__file__).parent.parent.parent \ - / 'tests' / 'dataset' + DATA_DIR = Path(__file__).parents[0] / 'dataset' def setUp(self): self.runner = CliRunner()