Skip to content

Commit 825c3d7

Browse files
Implement update mode for integration tests (#3536)
1 parent 62c49c5 commit 825c3d7

File tree

76 files changed

+646
-1279
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+646
-1279
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,22 @@ Befor running any test you have to build and install indigo-python
175175
python api/tests/integration/test.py -t 1 -p test_name
176176
```
177177
178+
>to update all tests "ref/" using -u flag
179+
```
180+
python api/tests/integration/test.py -u
181+
```
182+
183+
>to update all tests "ref/" without -u flag
184+
```
185+
export INDIGO_UPDATE_TESTS="True"
186+
python api/tests/integration/test.py
187+
```
188+
189+
>to update a single test's "ref/" by mask use `test_name` and -u flag
190+
```
191+
python api/tests/integration/test.py -t 1 -p test_name -u
192+
```
193+
178194
### To run backend API test:
179195
1) Build and install indigo-python
180196
2) Set environment variable by running this command:

api/tests/integration/common/env_indigo.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def moleculeLayoutDiff(
209209
ref,
210210
delta=0.01,
211211
ref_is_file=True,
212-
update=False,
212+
update=os.getenv("INDIGO_UPDATE_TESTS", "False") == "True",
213213
update_format="mol",
214214
):
215215
if ref_is_file:
@@ -268,7 +268,7 @@ def reactionLayoutDiff(
268268
ref,
269269
delta=0.001,
270270
ref_is_file=True,
271-
update=False,
271+
update=os.getenv("INDIGO_UPDATE_TESTS", "False") == "True",
272272
update_format="mol",
273273
):
274274
if ref_is_file:
@@ -297,6 +297,7 @@ def reactionLayoutDiff(
297297
r2.getMolecule(m.index()).molfile(),
298298
delta,
299299
ref_is_file=False,
300+
update=False,
300301
)
301302
error_buf.append("Molecule #{}: {}".format(m.index(), res))
302303
return "\n ".join(error_buf)

api/tests/integration/common/util.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import difflib
12
import os
23
import platform
34
import re
@@ -207,3 +208,30 @@ def check_jna_sha1():
207208
except Exception as e:
208209
os.remove(output_path)
209210
raise e
211+
212+
213+
def find_diff(a, b):
214+
return "\n".join(difflib.unified_diff(a.splitlines(), b.splitlines()))
215+
216+
217+
def compare_diff(ref_path, filename, data, stdout=True, diff_fn=find_diff):
218+
path_to_file = os.path.join(ref_path, filename)
219+
220+
is_update_required = os.getenv("INDIGO_UPDATE_TESTS", "False") == "True"
221+
if is_update_required:
222+
with open(path_to_file, "w") as file:
223+
file.write(data)
224+
225+
with open(path_to_file, "r") as file:
226+
data_ref = file.read()
227+
228+
diff = diff_fn(data_ref, data)
229+
230+
if not stdout:
231+
return diff
232+
233+
if not diff:
234+
print(filename + ":SUCCEED")
235+
else:
236+
print(filename + ":FAILED")
237+
print(diff)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
*** 2713 star atom support ***
2-
star_atom ket : SUCCEED
3-
star_atom scxmiles : SUCCEED
2+
star_atom.ket:SUCCEED
3+
*C.*N.*O |$star_e;;AH_p;;star_e;$|
Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
*** Mol to CDX ***
2-
enhanced_stereo1:success
3-
enhanced_stereo2:success
4-
enhanced_stereo3:success
5-
macro/sa-mono:success
6-
rgroup:success
7-
stereo_either-0020:success
8-
two_bn:success
2+
enhanced_stereo1.b64cdx:SUCCEED
3+
enhanced_stereo2.b64cdx:SUCCEED
4+
enhanced_stereo3.b64cdx:SUCCEED
5+
macro/sa-mono.b64cdx:SUCCEED
6+
rgroup.b64cdx:SUCCEED
7+
stereo_either-0020.b64cdx:SUCCEED
8+
two_bn.b64cdx:SUCCEED
99
*** KET to CDX ***
10-
issue_1774:success
11-
issue_1775:success
10+
issue_1774.b64cdx:SUCCEED
11+
issue_1775.b64cdx:SUCCEED
1212
molecule json loader: 'any' bonds are allowed only for queries
1313
*** Try as Query ***
1414
CDXML loader: Queries not supported
15-
issue_1777:success
16-
agents:success
15+
issue_1777.b64cdx:SUCCEED
16+
agents.b64cdx:SUCCEED
1717
*** CDXML to CDX ***
18-
AlcoholOxidation_Rxn1:success
19-
AlcoholOxidation_Rxn2:success
20-
Amidation_Rxn1:success
21-
Amidation_Rxn2:success
22-
BuchwaldHartwig_Rxn1:success
23-
BuchwaldHartwig_Rxn2:success
24-
CarbonylReduction_Rxn1:success
25-
CarbonylReduction_Rxn2:success
26-
Esterification_Rxn1:success
27-
Esterification_Rxn2:success
28-
Grignard_Rxn1:success
29-
Grignard_Rxn2:success
30-
N-Alkylation_Rxn1:success
31-
N-Alkylation_Rxn2:success
32-
N-Sulfonylation_Rxn1:success
33-
N-Sulfonylation_Rxn2:success
34-
O-Alkylation_Rxn1:success
35-
O-Alkylation_Rxn2:success
36-
Reductive Amination_Rxn1:success
37-
Reductive Amination_Rxn2:success
38-
SnAr_Rxn1:success
39-
SnAr_Rxn2:success
40-
Suzuki_Rxn1:success
41-
Suzuki_Rxn2:success
18+
AlcoholOxidation_Rxn1.b64cdx:SUCCEED
19+
AlcoholOxidation_Rxn2.b64cdx:SUCCEED
20+
Amidation_Rxn1.b64cdx:SUCCEED
21+
Amidation_Rxn2.b64cdx:SUCCEED
22+
BuchwaldHartwig_Rxn1.b64cdx:SUCCEED
23+
BuchwaldHartwig_Rxn2.b64cdx:SUCCEED
24+
CarbonylReduction_Rxn1.b64cdx:SUCCEED
25+
CarbonylReduction_Rxn2.b64cdx:SUCCEED
26+
Esterification_Rxn1.b64cdx:SUCCEED
27+
Esterification_Rxn2.b64cdx:SUCCEED
28+
Grignard_Rxn1.b64cdx:SUCCEED
29+
Grignard_Rxn2.b64cdx:SUCCEED
30+
N-Alkylation_Rxn1.b64cdx:SUCCEED
31+
N-Alkylation_Rxn2.b64cdx:SUCCEED
32+
N-Sulfonylation_Rxn1.b64cdx:SUCCEED
33+
N-Sulfonylation_Rxn2.b64cdx:SUCCEED
34+
O-Alkylation_Rxn1.b64cdx:SUCCEED
35+
O-Alkylation_Rxn2.b64cdx:SUCCEED
36+
Reductive Amination_Rxn1.b64cdx:SUCCEED
37+
Reductive Amination_Rxn2.b64cdx:SUCCEED
38+
SnAr_Rxn1.b64cdx:SUCCEED
39+
SnAr_Rxn2.b64cdx:SUCCEED
40+
Suzuki_Rxn1.b64cdx:SUCCEED
41+
Suzuki_Rxn2.b64cdx:SUCCEED
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
*** GenBank/GenPept to Seq***
2-
1844-gen_bank.seq.seq:SUCCEED
3-
1844-gen_pept.seq.seq:SUCCEED
4-
2763-gen_spaces.seq.seq:SUCCEED
2+
1844-gen_bank.seq:SUCCEED
3+
1844-gen_pept.seq:SUCCEED
4+
2763-gen_spaces.seq:SUCCEED

api/tests/integration/ref/formats/ket_to_ket.py.out

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
*** KET to KET ***
22
3087-star-process.ket:SUCCEED
33
images.ket:SUCCEED
4-
ambiguous_monomer.ket doc loadKetDocument: SUCCEED
5-
ambiguous_monomer.ket mol loadMolecule: SUCCEED
6-
ambiguous_monomer.ket mol loadQueryMolecule: SUCCEED
7-
expanded_monomer.ket doc loadKetDocument: SUCCEED
8-
expanded_monomer.ket mol loadMolecule: SUCCEED
9-
expanded_monomer.ket mol loadQueryMolecule: SUCCEED
10-
helm_alias.ket doc loadKetDocument: SUCCEED
11-
helm_alias.ket mol loadMolecule: SUCCEED
12-
helm_alias.ket mol loadQueryMolecule: SUCCEED
13-
helm_annotation.ket doc loadKetDocument: SUCCEED
14-
helm_annotation.ket mol loadMolecule: SUCCEED
15-
helm_annotation.ket mol loadQueryMolecule: SUCCEED
16-
modification_types.ket doc loadKetDocument: SUCCEED
17-
modification_types.ket mol loadMolecule: SUCCEED
18-
modification_types.ket mol loadQueryMolecule: SUCCEED
19-
monomer_shape.ket doc loadKetDocument: SUCCEED
20-
monomer_shape.ket mol loadMolecule: SUCCEED
21-
monomer_shape.ket mol loadQueryMolecule: SUCCEED
22-
monomer_transform.ket doc loadKetDocument: SUCCEED
23-
monomer_transform.ket mol loadMolecule: SUCCEED
24-
monomer_transform.ket mol loadQueryMolecule: SUCCEED
25-
2707_subst_count.ket ket: SUCCEED
26-
2707_subst_count.ket mol: SUCCEED
4+
ambiguous_monomer_doc.ket loadKetDocument:SUCCEED
5+
ambiguous_monomer_mol.ket loadMolecule:SUCCEED
6+
ambiguous_monomer_mol.ket loadQueryMolecule:SUCCEED
7+
expanded_monomer_doc.ket loadKetDocument:SUCCEED
8+
expanded_monomer_mol.ket loadMolecule:SUCCEED
9+
expanded_monomer_mol.ket loadQueryMolecule:SUCCEED
10+
helm_alias_doc.ket loadKetDocument:SUCCEED
11+
helm_alias_mol.ket loadMolecule:SUCCEED
12+
helm_alias_mol.ket loadQueryMolecule:SUCCEED
13+
helm_annotation_doc.ket loadKetDocument:SUCCEED
14+
helm_annotation_mol.ket loadMolecule:SUCCEED
15+
helm_annotation_mol.ket loadQueryMolecule:SUCCEED
16+
modification_types_doc.ket loadKetDocument:SUCCEED
17+
modification_types_mol.ket loadMolecule:SUCCEED
18+
modification_types_mol.ket loadQueryMolecule:SUCCEED
19+
monomer_shape_doc.ket loadKetDocument:SUCCEED
20+
monomer_shape_mol.ket loadMolecule:SUCCEED
21+
monomer_shape_mol.ket loadQueryMolecule:SUCCEED
22+
monomer_transform_doc.ket loadKetDocument:SUCCEED
23+
monomer_transform_mol.ket loadMolecule:SUCCEED
24+
monomer_transform_mol.ket loadQueryMolecule:SUCCEED
25+
2707_subst_count.ket:SUCCEED
26+
2707_subst_count.mol:SUCCEED
2727
3069-reaction.ket:SUCCEED
2828
multi_merge4.ket:SUCCEED
2929
mixed_reaction.ket:SUCCEED
Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
*** KET to MOL ***
2-
3068-star-issue.ket:SUCCEED
3-
3178-any-bond.ket:SUCCEED
4-
3227-copolymer.ket:SUCCEED
5-
3343-dir-expanded.ket:SUCCEED
6-
5amd.ket:SUCCEED
7-
accl_no_class.ket:SUCCEED
8-
acgt_1412.ket:SUCCEED
9-
anacyclamide.ket:SUCCEED
10-
chem.ket:SUCCEED
11-
chem_rna_hydro.ket:SUCCEED
12-
conj_no_class.ket:SUCCEED
13-
conjugate.ket:SUCCEED
14-
cysteine.ket:SUCCEED
15-
dala.ket:SUCCEED
16-
dcysteine.ket:SUCCEED
17-
dna_mod.ket:SUCCEED
18-
dthymine.ket:SUCCEED
19-
exp-valence-0.ket:SUCCEED
20-
flip_rotate.ket:SUCCEED
21-
flip_rotate_2000.ket:SUCCEED
22-
flip_rotate_rna.ket:SUCCEED
23-
fmoc.ket:SUCCEED
24-
hydro_atp_ch.ket:SUCCEED
25-
issue_1476.ket:SUCCEED
26-
issue_2699_rlogic.ket:SUCCEED
27-
issue_2702.ket:SUCCEED
28-
macro/R2R3R4.ket:SUCCEED
29-
macro/conjugates/pep-chem-rna.ket:SUCCEED
30-
macro/conjugates/peptide_rna.ket:SUCCEED
31-
macro/dendromers/dendro-peptide.ket:SUCCEED
32-
macro/disulfide/disulfide_peptide_cycle.ket:SUCCEED
33-
macro/hundred-monomers.ket:SUCCEED
34-
macro/left_phosphate/left_phosphate.ket:SUCCEED
35-
macro/linear/linear_dna.ket:SUCCEED
36-
macro/linear/linear_multi.ket:SUCCEED
37-
macro/linear/linear_peptide.ket:SUCCEED
38-
macro/linear/linear_rna.ket:SUCCEED
39-
macro/modified/mod_dna.ket:SUCCEED
40-
macro/modified/mod_peptide.ket:SUCCEED
41-
macro/modified/mod_rna.ket:SUCCEED
42-
macro/modified/mod_rna_peptide.ket:SUCCEED
43-
macro/peptide-rna/peptide-rna.ket:SUCCEED
44-
macro/peptide-rna/peptide-rna-ac.ket:SUCCEED
45-
macro/polyphosphate/polyphosphate_rna.ket:SUCCEED
46-
macro/sa-mono.ket:SUCCEED
47-
macro/terminators/terms_peptide.ket:SUCCEED
48-
mon_long_id.ket:SUCCEED
49-
pepchem.ket:SUCCEED
50-
peptides.ket:SUCCEED
51-
query_explicit_val.ket:SUCCEED
52-
rna_mod.ket:SUCCEED
53-
sgroup_class.ket:SUCCEED
54-
sgroups_mul.ket:SUCCEED
55-
suplabel.ket:SUCCEED
56-
taspoglutide.ket:SUCCEED
57-
thymine.ket:SUCCEED
58-
empty_apid.ket:SUCCEED
59-
ket-reaction-arrow.ket:SUCCEED
2+
3068-star-issue.mol:SUCCEED
3+
3178-any-bond.mol:SUCCEED
4+
3227-copolymer.mol:SUCCEED
5+
3343-dir-expanded.mol:SUCCEED
6+
5amd.mol:SUCCEED
7+
accl_no_class.mol:SUCCEED
8+
acgt_1412.mol:SUCCEED
9+
anacyclamide.mol:SUCCEED
10+
chem.mol:SUCCEED
11+
chem_rna_hydro.mol:SUCCEED
12+
conj_no_class.mol:SUCCEED
13+
conjugate.mol:SUCCEED
14+
cysteine.mol:SUCCEED
15+
dala.mol:SUCCEED
16+
dcysteine.mol:SUCCEED
17+
dna_mod.mol:SUCCEED
18+
dthymine.mol:SUCCEED
19+
exp-valence-0.mol:SUCCEED
20+
flip_rotate.mol:SUCCEED
21+
flip_rotate_2000.mol:SUCCEED
22+
flip_rotate_rna.mol:SUCCEED
23+
fmoc.mol:SUCCEED
24+
hydro_atp_ch.mol:SUCCEED
25+
issue_1476.mol:SUCCEED
26+
issue_2699_rlogic.mol:SUCCEED
27+
issue_2702.mol:SUCCEED
28+
macro/R2R3R4.mol:SUCCEED
29+
macro/conjugates/pep-chem-rna.mol:SUCCEED
30+
macro/conjugates/peptide_rna.mol:SUCCEED
31+
macro/dendromers/dendro-peptide.mol:SUCCEED
32+
macro/disulfide/disulfide_peptide_cycle.mol:SUCCEED
33+
macro/hundred-monomers.mol:SUCCEED
34+
macro/left_phosphate/left_phosphate.mol:SUCCEED
35+
macro/linear/linear_dna.mol:SUCCEED
36+
macro/linear/linear_multi.mol:SUCCEED
37+
macro/linear/linear_peptide.mol:SUCCEED
38+
macro/linear/linear_rna.mol:SUCCEED
39+
macro/modified/mod_dna.mol:SUCCEED
40+
macro/modified/mod_peptide.mol:SUCCEED
41+
macro/modified/mod_rna.mol:SUCCEED
42+
macro/modified/mod_rna_peptide.mol:SUCCEED
43+
macro/peptide-rna/peptide-rna.mol:SUCCEED
44+
macro/peptide-rna/peptide-rna-ac.mol:SUCCEED
45+
macro/polyphosphate/polyphosphate_rna.mol:SUCCEED
46+
macro/sa-mono.mol:SUCCEED
47+
macro/terminators/terms_peptide.mol:SUCCEED
48+
mon_long_id.mol:SUCCEED
49+
pepchem.mol:SUCCEED
50+
peptides.mol:SUCCEED
51+
query_explicit_val.mol:SUCCEED
52+
rna_mod.mol:SUCCEED
53+
sgroup_class.mol:SUCCEED
54+
sgroups_mul.mol:SUCCEED
55+
suplabel.mol:SUCCEED
56+
taspoglutide.mol:SUCCEED
57+
thymine.mol:SUCCEED
58+
empty_apid.mol:SUCCEED
59+
ket-reaction-arrow.mol:SUCCEED
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
*** KET to 3 LETTER SEQUENCE ***
2-
peptides_3letter : SUCCEED
2+
peptides_3letter.seq3:SUCCEED
33
Test 'issue_3200': got expected error 'Only amino acids can be saved as three letter amino acid codes'
44
Test 'peptides_molecule': got expected error 'Sequence saver: Can't save micro-molecules to sequence format'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
*** KET to MOL ***
2-
ket_with_mult_group.ket:SUCCEED
2+
ket_with_mult_group.mol:SUCCEED

0 commit comments

Comments
 (0)