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: INCHI-1-TEST/README.md
+75-33Lines changed: 75 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
# Library tests
1
+
# Testing the InChI
2
2
3
3
## Test environment
4
4
5
5
### Docker container
6
6
7
-
Use our [Dockerfile](../Dockerfile) to run the test suite.
7
+
Use our [Dockerfile](Dockerfile) to run the test suite.
8
8
Build a Docker image by running the following command from the root of the repository:
9
9
10
10
```Shell
@@ -22,14 +22,57 @@ You can now run the commands that are mentioned in the remainder of this README.
22
22
23
23
### Visual Studio Code devcontainer
24
24
25
-
If you prefer, run the tests in the [Visual Studio Code devcontainer](https://code.visualstudio.com/docs/devcontainers/containers)
26
-
that's specified under [.devcontainer.json](../../.devcontainer.json).
27
-
Note that in the devcontainer, you'll have to compile the InChI libraries yourself, see `INCHI-1-TEST/compile_inchi.sh` for details.
28
-
The test pipeline expects the library under `INCHI-1-TEST/libs`, see for example `INCHI-1-TEST/tests/test_library/config/config.invariance.py`.
25
+
As an alternative to the plain Docker container, you can run the tests in the [Visual Studio Code devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) that's specified under [.devcontainer.json](../.devcontainer.json).
26
+
Note that, in contrast to the plain container, in the devcontainer, you'll have to compile the InChI libraries yourself.
27
+
Have a look at [the compilation script](compile_inchi.sh) for details.
29
28
30
-
## Datasets
29
+
## Test data
31
30
32
-
In this README, `<dataset>` refers to either `ci`
31
+
We follow two conventions for supplying molfiles as test data.
32
+
33
+
- Inline Python string in a testfile:
34
+
35
+
- Benefit of having entire test scenario on screen.
36
+
- Only use with small(ish) molfiles, the benefit of overview is lost quickly with molfiles that require vertical scrolling.
The script triggers a segfault should the thread safety of the library be compromised.
101
+
The script triggers a segfault in case the thread safety of the library is compromised.
59
102
60
-
## Invariance tests
103
+
###Invariance tests
61
104
62
105
Invariance tests are meant to detect problems with InChI's canonicalization algorithm.
63
106
During an invariance test, the atom indices of a structure are permuted repeatedly and each permutation is expected to result in the same InChI output.
@@ -110,7 +152,7 @@ To convince yourself that the tests fail once a regression has been introduced,
110
152
change `INCHI_NAME` in `INCHI-1-SRC/INCHI_BASE/src/mode.h` and re-run the tests.
111
153
The tests should now fail and indicate that the difference between the reference results and the latest test run is the change you've made.
112
154
113
-
## Inspect test results
155
+
###Inspect test results
114
156
115
157
In addition to inspecting the raw logs, you can review the results by running
116
158
@@ -122,17 +164,17 @@ where `<test>` can be `regression` or `invariance`.
122
164
The command generates an HTML report for each SDF under `INCHI-1-TEST/tests/test_library/data/<dataset>` that contains structures which failed the test.
123
165
You can view the HTML report in your browser.
124
166
125
-
## Inspect `.sqlite` files
167
+
###Inspect `.sqlite` files
126
168
127
169
For conveniently viewing `.sqlite` files, install the `SQLite Viewer` extension for VSCode: <https://marketplace.visualstudio.com/items?itemName=qwtel.sqlite-viewer>. Otherwise you can query the `.sqlite` files with the [sqlite command line utility](https://sqlite.org/cli.html).
128
170
129
-
## Test customization
171
+
###Test customization
130
172
131
173
So far, we showed how to run the tests with our configuration against our datasets.
132
174
Alternatively, you can run the tests against your own data and/or adapt the configuration.
133
175
134
176
Before showing examples of how to customize the tests, let's look at how we're configuring them.
135
-
Our [docker-compose.yml](../docker-compose.yml) shows how to inject the data and configuration into the [container](#docker-container)
177
+
Our [docker-compose.yml](docker-compose.yml) shows how to inject the data and configuration into the [container](#docker-container)
136
178
via [volumes](https://docs.docker.com/compose/compose-file/05-services/#volumes):
137
179
138
180
```yml
@@ -162,7 +204,7 @@ services:
162
204
Make sure to adapt `context` to your directory structure. `context` needs to be the path to the `InChI` repository,
163
205
relative from `docker-compose.custom.yml`.
164
206
165
-
### Your own dataset
207
+
#### Your own dataset
166
208
167
209
You can map a single SDF file or a directory containing SDF files into the container's `/inchi` directory by specifying a volume:
168
210
@@ -180,7 +222,7 @@ services:
180
222
target: /inchi/data
181
223
```
182
224
183
-
### Your own configuration
225
+
#### Your own configuration
184
226
185
227
Next, add a volume to inject your [configuration files](#configuration-files) into the container:
186
228
@@ -201,32 +243,32 @@ services:
201
243
target: /inchi/config
202
244
```
203
245
204
-
### Configuration files
246
+
#### Configuration files
205
247
206
248
The tests can be configured with Python files (e.g., `config.py`).
207
249
We're not using other configuration formats (e.g., `config.yaml`),
208
250
since the configuration needs to be powerful enough to enable dynamic customization (e.g., parsing molfile ID).
209
-
We provide two [templates](INCHI-1-TEST/tests/test_library/inchi_tests/config_models.py) under `config_models.py` that allow you to customize the configuration:
251
+
We provide two [templates](tests/test_library/inchi_tests/config_models.py) under `config_models.py` that allow you to customize the configuration:
210
252
211
-
#### `TestConfig`
253
+
##### `TestConfig`
212
254
213
255
Lets you customize the test itself, e.g.,
214
256
configuring what to run ("regression", "regression-reference", or "invariance"),
215
257
which InChI library to use, and which parameters to pass to the InChI API.
216
258
For details, have a look at the comments in the `TestConfig` class.
217
259
Your configuration file, e.g., `config/custom-regression.py` must contain an instance of `TestConfig` called `config`.
218
-
For an example of how to instantiate a `TestConfig` object, have a look at our [regression configuration](INCHI-1-TEST/tests/test_library/config/config.regression.py).
260
+
For an example of how to instantiate a `TestConfig` object, have a look at our [regression configuration](tests/test_library/config/config.regression.py).
219
261
220
-
#### `DataConfig`
262
+
##### `DataConfig`
221
263
222
264
Lets you configure your custom data, e.g., location of the data.
223
265
For details, have a look at the comments in the `DataConfig` class.
224
266
Your configuration file, e.g., `config/custom-data.py` must contain an instance of `DataConfig` called `config`.
225
-
For an example of how to instantiate a `DataConfig` object, have a look at our [CI configuration](INCHI-1-TEST/tests/test_library/config/config.ci.py).
267
+
For an example of how to instantiate a `DataConfig` object, have a look at our [CI configuration](tests/test_library/config/config.ci.py).
226
268
Note that the `DataConfig` object must point to data that you've [mounted into the container](#your-own-dataset).
227
-
For an example of how to instantiate a `DataConfig` object, have a look at our the configuration of our [CI data](INCHI-1-TEST/tests/test_library/config/config.ci.py).
269
+
For an example of how to instantiate a `DataConfig` object, have a look at our the configuration of our [CI data](tests/test_library/config/config.ci.py).
228
270
229
-
### Run your custom tests
271
+
#### Run your custom tests
230
272
231
273
Once you've written the `docker-compose.custom.yml` and your [configuration files](#configuration-files), build a custom image with
0 commit comments