Skip to content

Commit c0ffef2

Browse files
author
Alan Christie
committed
- PipelineTester has version number (and logs it)
- Also reports number of files - Adds some test files to rdkit_utils and a test data file
1 parent 01f7d8a commit c0ffef2

File tree

7 files changed

+65
-8
lines changed

7 files changed

+65
-8
lines changed

data/Kinase_inhibs.sdf.gz

10.8 KB
Binary file not shown.

src/groovy/PipelineTester.groovy

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env groovy
22

33
/**
4-
* Copyright (c) 2017 Informatics Matters Ltd.
4+
* Copyright (c) 2018 Informatics Matters Ltd.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -43,6 +43,9 @@ import groovy.text.SimpleTemplateEngine
4343
*/
4444
class Tester {
4545

46+
// Version (try and update with every change/release)
47+
String version = '1.0'
48+
4649
// Supported test-script versions
4750
def supportedTestFileVersions = [1]
4851

@@ -75,6 +78,7 @@ class Tester {
7578
int sectionNumber = 0
7679
int testsExecuted = 0
7780
int testsIgnored = 0
81+
int filesUsed = 0
7882
def failedTests = []
7983
def observedFiles = []
8084

@@ -99,7 +103,11 @@ class Tester {
99103
*/
100104
boolean run() {
101105

102-
// before we start - cleanup (everything)
106+
// Log versions
107+
info("PipelineTester: v$version")
108+
info("Supporting test file versions: $supportedTestFileVersions")
109+
110+
// Before we start - cleanup (everything)
103111
cleanUpOutput(true)
104112

105113
// Find all the potential test files
@@ -115,6 +123,7 @@ class Tester {
115123
testScriptVersion = 0
116124
testTimeoutSeconds = 30
117125
collectionCreates = []
126+
filesUsed += 1
118127

119128
// We must not have duplicate test files -
120129
// this indicates there are pipelines in different projects
@@ -212,9 +221,10 @@ class Tester {
212221
println "Failed: $name"
213222
}
214223
}
215-
println "Num executed: $testsExecuted"
216-
println "Num ignored : $testsIgnored"
217-
println "Num failed : $failedTests.size"
224+
println "Test Files : " + sprintf('%4d', filesUsed)
225+
println "Tests : " + sprintf('%4d', testsExecuted)
226+
println "Tests ignored: " + sprintf('%4d', testsIgnored)
227+
println "Tests failed : " + sprintf('%4d', failedTests.size())
218228
separate()
219229
println "Passed: ${testPassed.toString().toUpperCase()}"
220230

src/groovy/pipeline.test.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@
114114
// Metrics.
115115
//
116116
// If your pipeline creates standard metrics - a Java properties file
117-
// with the name 'output_metrics.txt' you can use the metrics block
118-
// here to check the generated values. You can specify a property
117+
// with the name 'output_metrics.txt' - you can use the metrics block
118+
// here to check its content. You can specify a property
119119
// (a key) and a regular expression string value.
120120

121121
metrics: [ __StatusMessage__: 'kel: 0.171, t1/2: 4.06, V: 7.07, CL: 20.1' ]

src/python/rdkit_utils/filter.test

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Automated pipeline test specification.
2+
3+
[
4+
5+
version = 1,
6+
7+
// Testing filter.py reading from STDIN and writing to STDOUT
8+
test_in_to_out = [
9+
10+
command: '''gunzip -c ../../data/Kinase_inhibs.sdf.gz |
11+
python -m rdkit_utils.filter
12+
--hacmin 25 --hacmax 30 -if sdf''',
13+
14+
see: [ 'No output format specified - using sdf',
15+
'Filtered [1-9]\\d+ down to [1-9]\\d+ molecules'],
16+
17+
],
18+
19+
]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Automated pipeline test specification.
2+
3+
[
4+
5+
version = 1,
6+
7+
// Test basic startup
8+
test_help = [
9+
10+
command: '''python -m rdkit_utils.sdf2json -h''',
11+
12+
],
13+
14+
]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Automated pipeline test specification.
2+
3+
[
4+
5+
version = 1,
6+
7+
// Test basic startup
8+
test_help = [
9+
10+
command: '''python -m rdkit_utils.splitter -h''',
11+
12+
],
13+
14+
]

src/python/test/pipelines_utils/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
class UtilsTestCase(unittest.TestCase):
77

8-
98
def test_round_sig(self):
109
"""Rounding of significant figures
1110
"""
1211
self.assertEquals(utils.round_sig(1.23456789, 2), 1.2)
1312
self.assertEquals(utils.round_sig(1.23456789, 3), 1.23)
1413
self.assertEquals(utils.round_sig(1.23456789, 6), 1.23457)
1514

15+
self.assertEquals(utils.round_sig(-1.23456789, 6), -1.23457)

0 commit comments

Comments
 (0)