Skip to content

Commit 8a4a5e8

Browse files
author
alanbchristie
authored
Merge pull request #16 from InformaticsMatters/issue-10
Issue 10
2 parents 4916ea2 + 933d11c commit 8a4a5e8

File tree

5 files changed

+63
-6
lines changed

5 files changed

+63
-6
lines changed

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ text-file format used to both describe and execute built-in tests.
88
## Execution environment
99
You will need: -
1010

11-
- Groovy
1211
- Conda
12+
- Groovy (v2.4)
13+
- Python
1314

1415
Although the project is based on [Gradle], which is Groovy-based,
1516
you will need to install **Groovy**. We've tested this framework using Groovy
@@ -170,10 +171,46 @@ that can be tested using `setup.py`. To test these modules run the
170171
following from the `src/python` directory: -
171172

172173
$ python setup.py test
173-
174+
175+
## Considerations for Windows
176+
The tests and test framework are designed to operate from within a unix-like
177+
environment but if you are forced to execute pipeline tests from Windows the
178+
following approach is recommended: -
179+
180+
You will need:
181+
182+
- Conda
183+
- Groovy (v2.4)
184+
- Git-Bash
185+
186+
1. Install [Git for Windows]. This will give you a unix bash-like
187+
execution environment
188+
1. From within the Git-bash shell navigate to your pipelines project.
189+
1. Ensure that you can execute both Python and Groovy from within the
190+
Git-Bash shell (i.e. `python --version` and `groovy --version` work)
191+
1. From the pipelines project root enter your Conda environment
192+
with something like `source activate my-conda-env`. To run the
193+
pipelines tests your environment must contain the rdkit package. It
194+
can be installed with this command from within Conda...
195+
196+
$ conda install -c rdkit rdkit
197+
198+
1. Install additional modules required by `pipelines-utils` but
199+
using its requirements file (which can be found in the `pipelines-utils`
200+
sub-project): -
201+
202+
$ pip install -r requirements.txt
203+
204+
With the above steps complete you should be able to execute the pipelines
205+
tester by navigating to the sub-module in your pipelines project: -
206+
207+
$ cd pipelines-utils
208+
$ ./gradlew runPipelineTester
209+
174210
---
175211

176212
[Conda]: https://conda.io/docs/
213+
[Git for Windows]: http://gitforwindows.org
177214
[Gradle]: https://gradle.org
178215
[Groovy]: http://groovy-lang.org
179216
[PIP]: https://pypi.python.org/pypi

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Additional modules we depend on.
22
# Required from within an RDKIT Conda environment
33

4-
matplotlib == 2.1.1
54
molvs == 0.0.9
65
standardiser == 0.1.9

src/groovy/ContainerExecutor.groovy

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,16 @@ class ContainerExecutor {
4848
StringBuilder sout = new StringBuilder()
4949
StringBuilder serr = new StringBuilder()
5050

51-
// Note: PIN and POUT have trailing forward-slashed for now
51+
// Windows/Git-Bash PIN/POUT path tweak...
52+
String osName = System.properties['os.name']
53+
if (osName && osName.startsWith('Win')) {
54+
pin = pin.replace('\\', '/')
55+
pin = pin.replace('C:', '/c')
56+
pout = pout.replace('\\', '/')
57+
pout = pout.replace('C:', '/c')
58+
}
59+
60+
// Note: PIN and POUT have trailing forward-slashes for now
5261
// to allow a migratory use of $PIN}file references
5362
// rather than insisting on ${PIN}/file which would fail if
5463
// PIN wasn't defined - it's about lowest risk changes.

src/groovy/PipelineTester.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
// Version
3333
// Update with every change/release
34-
String version = '2.1.0'
34+
String version = '2.1.1'
3535

3636
println "+----------------+"
3737
println "| PipelineTester | v$version"

src/groovy/ShellExecutor.groovy

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ class ShellExecutor {
2424

2525
/**
2626
* Executes the given command using the shell in the supplied execution
27-
* directory.
27+
* directory. Normally this would be executed in a unix-like environment.
28+
* In Windows this would be from something like a Git-Bash shell.
2829
*
2930
* @param command The command to run
3031
* @param edir The directory in which to run the command
32+
* (execution directory)
3133
* @param pin The pipeline input directory
3234
* (used to define the PIN environment variable)
3335
* @param pout The pipeline output directory
@@ -43,6 +45,16 @@ class ShellExecutor {
4345

4446
StringBuilder sout = new StringBuilder()
4547
StringBuilder serr = new StringBuilder()
48+
49+
// Windows/Git-Bash PIN/POUT path tweak...
50+
String osName = System.properties['os.name']
51+
if (osName && osName.startsWith('Win')) {
52+
pin = pin.replace('\\', '/')
53+
pin = pin.replace('C:', '/c')
54+
pout = pout.replace('\\', '/')
55+
pout = pout.replace('C:', '/c')
56+
}
57+
4658
// Append '/' to PIN and POUT to allow '${POUT}output'
4759
String cmd = "PIN=$pin/; POUT=$pout/; " + command
4860
def proc = ['sh', '-c', cmd].execute(null, edir)

0 commit comments

Comments
 (0)