You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: TESTING.md
+12-17Lines changed: 12 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,7 @@ Tests can be found in `graphdatascience/tests`. In each of the folders there, `u
7
7
Please see the section [Specifically for this project](CONTRIBUTING.md#specifically-for-this-project) of our [contribution guidelines](CONTRIBUTING.md) for how to set up an environment for testing and style checking.
8
8
9
9
> **_NOTE:_** This document does not cover documentation testing.
10
-
Please see the [documentation README](doc/README.md#testing) for that.
11
-
10
+
> Please see the [documentation README](doc/README.md#testing) for that.
12
11
13
12
## Unit testing
14
13
@@ -20,45 +19,47 @@ To run the unit tests (with default options), simply call:
20
19
pytest graphdatascience/tests/unit
21
20
```
22
21
22
+
or for just `just unit-tests`
23
23
24
24
## Integration testing
25
25
26
26
In order to run the integration tests one must have a [Neo4j DBMS](https://neo4j.com/docs/getting-started/current/) with the Neo4j Graph Data Science library installed running.
27
27
28
+
If you want to use just, you can use `just it`.
28
29
29
30
### V2 endpoints
30
31
31
32
The integration tests for the V2 endpoints are located in `graphdatascience/tests/integration/v2`.
32
33
In order to run the tests, you need to have Docker running.
33
34
You also need to either bring two Docker images, or configure authenticated access to the GCP repository where the production Docker images are stored.
34
35
36
+
If you want to use just, you can use `just it-v2`.
35
37
36
38
### Bringing your own Docker images
37
39
38
40
Set the environment variables `NEO4J_DATABASE_IMAGE` and `GDS_SESSION_IMAGE` to the names of the Docker images you want to use.
39
41
40
-
41
42
### Configuring authenticated access to the GCP repository
If you do not want to use a custom neo4j db, you can use the test-envs under `scripts/test-envs`.
51
+
50
52
The tests will through the [Neo4j Python driver](https://neo4j.com/docs/python-manual/current/) connect to a Neo4j database based on the environment variables:
51
53
52
-
*`NEO4J_URI` (defaulting to "bolt://localhost:7687" if unset),
53
-
*`NEO4J_USER`,
54
-
*`NEO4J_PASSWORD` (defaulting to "neo4j" if unset),
55
-
*`NEO4J_DB` (defaulting to "neo4j" if unset).
54
+
-`NEO4J_URI` (defaulting to "bolt://localhost:7687" if unset),
55
+
-`NEO4J_USER`,
56
+
-`NEO4J_PASSWORD` (defaulting to "neo4j" if unset),
57
+
-`NEO4J_DB` (defaulting to "neo4j" if unset).
56
58
57
59
However, if `NEO4J_USER` is not set the tests will try to connect without authentication.
58
60
59
61
Once the driver connects successfully to the Neo4j DBMS the tests will go on to execute against the `NEO4J_DB` database.
60
62
61
-
62
63
### Running
63
64
64
65
To run the integration tests (with default options), simply call:
@@ -75,7 +76,6 @@ Note however that this also requires you to have specified a valid path for the
75
76
76
77
If the database you are targeting is an AuraDS instance, you should use the option `--target-aura` which makes sure that tests of operations not supported on AuraDS are skipped.
77
78
78
-
79
79
### Running tests that require encrypted connections
80
80
81
81
In order to run integration tests that test encryption features, you must setup the Neo4j server accordingly:
@@ -99,14 +99,12 @@ To run only integration tests that are marked as `encrypted_only`, call:
There are integration tests that are only compatible with certain versions of the GDS library.
106
105
For example, a procedure (which does not follow the standard algorithm procedure pattern) introduced in version 2.1.0 of the library will not exist in version 2.0.3, and so any client side integration tests that call this procedure should not run when testing against server library version 2.0.3.
107
106
For this reason only tests compatible with the GDS library server version you are running against will run.
108
107
109
-
110
108
## Style guide
111
109
112
110
The code and examples use [ruff](hhttps://docs.astral.sh/ruff/) to format and lint.
@@ -116,7 +114,6 @@ Use `SKIP_NOTEBOOKS=true` to only format the code.
116
114
117
115
See `pyproject.toml` for the configuration.
118
116
119
-
120
117
### Static typing
121
118
122
119
The code is annotated with type hints in order to provide documentation and allow for static type analysis with [mypy](http://mypy-lang.org/).
@@ -129,18 +126,16 @@ mypy .
129
126
130
127
from the root. See `mypy.ini` for our custom mypy settings.
131
128
132
-
133
129
## Notebook examples
134
130
135
131
The notebooks under `/examples` can be run using `scripts/run_notebooks`.
136
132
137
-
138
133
### Cell Tags
139
134
140
-
*Verify version*
135
+
_Verify version_
141
136
If you only want to let CI run the notebook given a certain condition, tag a given cell in the notebook with `verify-version`.
142
137
As the name suggests, the tag was introduced to only run for given GDS server versions.
143
138
144
-
*Teardown*
139
+
_Teardown_
145
140
146
141
To make sure certain cells are always run even in case of failure, tag the cell with `teardown`.
0 commit comments