Skip to content

Commit f6be442

Browse files
committed
imporved tests setup
1 parent 15aeb49 commit f6be442

File tree

7 files changed

+30
-26
lines changed

7 files changed

+30
-26
lines changed

fragnet-search/build.gradle

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ plugins {
2626

2727
description = 'Fragment network search'
2828

29+
// To run the tests you must setup RDBASE to point to a valid RDKit build that includes
30+
// The Java wrappers. To do this follow the "Building from Source" instructions found here:
31+
// http://rdkit.org/docs/Install.html#building-from-source
32+
// Just do a build - don't do a `make install` and then set the RDBASE environment variable
33+
// to the top level directory for that checkout.
34+
// You do not need to do this to build the code, just to test it. If RDBASE is not defined a locally provided
35+
// org.RDKit.jar is user to allow compilation.
36+
// If the RDBASE environment variable is not defined the tests that require RDKit functionality are ignored.
37+
2938
String RDBASE = System.getenv('RDBASE') ?: ''
3039
String RDKitJarFile = RDBASE + '/Code/JavaWrappers/gmwrapper/org.RDKit.jar'
3140
boolean RDKitJava = RDBASE && file(RDKitJarFile).exists()
@@ -82,7 +91,7 @@ tomcat {
8291
}
8392

8493
task createNeoContainer(type: DockerCreateContainer) {
85-
targetImageId 'informaticsmatters/fragnet-test:3.5-xchem-v1-build-2'
94+
targetImageId 'informaticsmatters/fragnet-test:3.5.25-xchem-combi-sample-2021-02'
8695
portBindings = ['7474:7474','7687:7687']
8796
envVars = ['NEO4J_dbms_memory_pagecache_size': '2g',
8897
'NEO4J_dbms_memory_heap_initial__size': '2g',
@@ -104,11 +113,10 @@ task stopNeoContainer(type: DockerStopContainer) {
104113

105114
test {
106115
environment = [
107-
// TODO - fix the hard coded RDBASE setup.
108-
'NEO4J_PASSWORD':'test123',
109-
'NEO4J_SERVER':'localhost',
110-
'LD_LIBRARY_PATH':'/home/timbo/github/rdkit/rdkit_2020_03/Code/JavaWrappers/gmwrapper:/usr/x86_64-linux-gnu',
111-
'RDBASE':'/home/timbo/github/rdkit/rdkit_2020_03'
116+
'NEO4J_PASSWORD': 'test123',
117+
'NEO4J_SERVER': 'localhost',
118+
'LD_LIBRARY_PATH': RDBASE + '/build/Code/JavaWrappers/gmwrapper:/usr/x86_64-linux-gnu',
119+
'RDBASE': RDBASE
112120
]
113121
// beforeTest { descriptor ->
114122
// logger.lifecycle("Running test: " + descriptor)
@@ -126,7 +134,7 @@ task buildDockerFile(type: Dockerfile) {
126134
]
127135

128136
destFile = project.file('build/Dockerfile')
129-
from "informaticsmatters/rdkit-tomcat-debian:Release_2020_09"
137+
from "informaticsmatters/rdkit-tomcat-debian:latest"
130138
label(['maintainer': 'Tim Dudgeon "[email protected]"'])
131139

132140
// include the keycloak adapters

fragnet-search/src/test/groovy/org/squonk/fragnet/chem/MolStandardizeSpec.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ package org.squonk.fragnet.chem
1717

1818
import org.RDKit.RDKFuncs
1919
import org.RDKit.RWMol
20-
20+
import spock.lang.IgnoreIf
2121
import spock.lang.Specification
2222

23+
@IgnoreIf({!env.RDBASE})
2324
class MolStandardizeSpec extends Specification {
2425

2526
static {
2627
Runtime.getRuntime().loadLibrary0(groovy.lang.GroovyClassLoader.class, "GraphMolWrap")
2728
}
2829

29-
3030
void "rdkit version"() {
3131

3232
when:

fragnet-search/src/test/groovy/org/squonk/fragnet/chem/TransformClassifierSpec.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ import org.RDKit.RWMol
1919
import org.squonk.fragnet.search.model.v2.GroupingType
2020
import org.squonk.fragnet.search.model.v2.MolTransform
2121
import org.squonk.fragnet.search.model.v2.TransformData
22+
import spock.lang.IgnoreIf
2223
import spock.lang.Specification
2324

25+
@IgnoreIf({!env.RDBASE})
2426
class TransformClassifierSpec extends Specification {
2527

2628
static {

fragnet-search/src/test/groovy/org/squonk/fragnet/search/queries/v2/AvailabilityQuerySpec.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@ package org.squonk.fragnet.search.queries.v2
1818
import org.neo4j.driver.v1.Session
1919
import org.squonk.fragnet.AbstractGraphDBSpec
2020
import org.squonk.fragnet.search.model.v2.Availability
21+
import spock.lang.IgnoreIf
2122

23+
@IgnoreIf({!env.RDBASE})
2224
class AvailabilityQuerySpec extends AbstractGraphDBSpec {
2325

24-
2526
void "simple search"() {
2627

2728
Session session = graphDB.getSession()
2829
AvailabilityQuery query = new AvailabilityQuery(session)
2930

3031
when:
31-
Availability a = query.getAvailability("CCOc1ccccc1CN1CCC(O)CC1")
32+
Availability a = query.getAvailability("N#Cc1cccc(N(CC(=O)O)C2CC2)n1")
3233
println "Found ${a.items.size()} items"
3334

3435
then:

fragnet-search/src/test/groovy/org/squonk/fragnet/search/queries/v2/ExpansionQuerySpec.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ package org.squonk.fragnet.search.queries.v2
1818
import org.neo4j.driver.v1.Session
1919
import org.squonk.fragnet.AbstractGraphDBSpec
2020
import org.squonk.fragnet.search.model.v2.ExpansionResults
21+
import spock.lang.IgnoreIf
2122

23+
@IgnoreIf({!env.RDBASE})
2224
class ExpansionQuerySpec extends AbstractGraphDBSpec {
2325

2426
static {
@@ -30,7 +32,7 @@ class ExpansionQuerySpec extends AbstractGraphDBSpec {
3032
ExpansionQuery query = new ExpansionQuery(session, null)
3133

3234
when:
33-
ExpansionResults results = query.executeQuery("CCOc1ccccc1CN1CCC(O)CC1", "chemical/x-daylight-smiles",
35+
ExpansionResults results = query.executeQuery("Cc1cc(Cl)c(C(=O)CN)s1", "chemical/x-daylight-smiles",
3436
1, 10, 10, 3, 3, null)
3537
println "Found ${results.getSize()} items"
3638

fragnet-search/src/test/groovy/org/squonk/fragnet/search/queries/v2/HitExpanderSpec.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ import org.neo4j.driver.v1.Session
1919
import org.squonk.fragnet.AbstractGraphDBSpec
2020
import org.squonk.fragnet.Constants
2121
import org.squonk.fragnet.search.model.v2.ConvertedSmilesMols
22+
import spock.lang.IgnoreIf
2223

24+
@IgnoreIf({!env.RDBASE})
2325
class HitExpanderSpec extends AbstractGraphDBSpec {
2426

2527
static {

fragnet-search/src/test/groovy/org/squonk/fragnet/search/queries/v2/SimpleNeighbourhoodQuerySpec.groovy

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,23 @@ import org.squonk.fragnet.AbstractGraphDBSpec
2020
import org.squonk.fragnet.search.model.v2.NeighbourhoodGraph
2121
import org.squonk.fragnet.service.GraphDB
2222
import spock.lang.Ignore
23+
import spock.lang.IgnoreIf
2324

25+
@IgnoreIf({!env.RDBASE})
2426
class SimpleNeighbourhoodQuerySpec extends AbstractGraphDBSpec {
2527

2628
static {
2729
Runtime.getRuntime().loadLibrary0(groovy.lang.GroovyClassLoader.class, "GraphMolWrap")
2830
}
2931

30-
@Ignore
31-
void "4-hydroxy-biphenyl-1-hop"() {
32-
GraphDB db = new GraphDB()
33-
Session session = db.getSession()
34-
35-
when:
36-
NeighbourhoodQuery query = new NeighbourhoodQuery(session, [:])
37-
NeighbourhoodGraph result = query.executeNeighbourhoodQuery('Oc1ccc(-c2ccccc2)cc1', 1, 3, 1, null, 10)
38-
print "Results: $result.nodeCount"
39-
40-
then:
41-
result.nodeCount > 0
42-
}
4332

4433
void "1-hop neighbourhood query"() {
4534
GraphDB db = new GraphDB()
4635
Session session = db.getSession()
4736

4837
when:
4938
NeighbourhoodQuery query = new NeighbourhoodQuery(session, [:])
50-
NeighbourhoodGraph result = query.executeNeighbourhoodQuery('CCOc1ccccc1CN1CCC(O)CC1', 1, 3, 1, null, 10)
39+
NeighbourhoodGraph result = query.executeNeighbourhoodQuery('Brc1cnc(N2CCCC2)nc1', 1, 3, 1, null, 10)
5140
print "Results: $result.nodeCount"
5241

5342
then:

0 commit comments

Comments
 (0)