diff --git a/README.md b/README.md index 4bcb863..bbed301 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,9 @@ text-file format used to both describe and execute built-in tests. ## Execution environment You will need: - -- Groovy - Conda +- Groovy (v2.4) +- Python Although the project is based on [Gradle], which is Groovy-based, 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 following from the `src/python` directory: - $ python setup.py test - + +## Considerations for Windows +The tests and test framework are designed to operate from within a unix-like +environment but if you are forced to execute pipeline tests from Windows the +following approach is recommended: - + +You will need: + +- Conda +- Groovy (v2.4) +- Git-Bash + +1. Install [Git for Windows]. This will give you a unix bash-like + execution environment +1. From within the Git-bash shell navigate to your pipelines project. +1. Ensure that you can execute both Python and Groovy from within the + Git-Bash shell (i.e. `python --version` and `groovy --version` work) +1. From the pipelines project root enter your Conda environment + with something like `source activate my-conda-env`. To run the + pipelines tests your environment must contain the rdkit package. It + can be installed with this command from within Conda... + + $ conda install -c rdkit rdkit + +1. Install additional modules required by `pipelines-utils` but + using its requirements file (which can be found in the `pipelines-utils` + sub-project): - + + $ pip install -r requirements.txt + +With the above steps complete you should be able to execute the pipelines +tester by navigating to the sub-module in your pipelines project: - + + $ cd pipelines-utils + $ ./gradlew runPipelineTester + --- [Conda]: https://conda.io/docs/ +[Git for Windows]: http://gitforwindows.org [Gradle]: https://gradle.org [Groovy]: http://groovy-lang.org [PIP]: https://pypi.python.org/pypi diff --git a/requirements.txt b/requirements.txt index b969c72..9c67390 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ # Additional modules we depend on. # Required from within an RDKIT Conda environment -matplotlib == 2.1.1 molvs == 0.0.9 standardiser == 0.1.9 diff --git a/src/groovy/ContainerExecutor.groovy b/src/groovy/ContainerExecutor.groovy index 3f7a241..fad6d08 100644 --- a/src/groovy/ContainerExecutor.groovy +++ b/src/groovy/ContainerExecutor.groovy @@ -48,7 +48,16 @@ class ContainerExecutor { StringBuilder sout = new StringBuilder() StringBuilder serr = new StringBuilder() - // Note: PIN and POUT have trailing forward-slashed for now + // Windows/Git-Bash PIN/POUT path tweak... + String osName = System.properties['os.name'] + if (osName && osName.startsWith('Win')) { + pin = pin.replace('\\', '/') + pin = pin.replace('C:', '/c') + pout = pout.replace('\\', '/') + pout = pout.replace('C:', '/c') + } + + // Note: PIN and POUT have trailing forward-slashes for now // to allow a migratory use of $PIN}file references // rather than insisting on ${PIN}/file which would fail if // PIN wasn't defined - it's about lowest risk changes. diff --git a/src/groovy/PipelineTester.groovy b/src/groovy/PipelineTester.groovy index 82ad442..791ef13 100644 --- a/src/groovy/PipelineTester.groovy +++ b/src/groovy/PipelineTester.groovy @@ -31,7 +31,7 @@ // Version // Update with every change/release -String version = '2.1.0' +String version = '2.1.1' println "+----------------+" println "| PipelineTester | v$version" diff --git a/src/groovy/ShellExecutor.groovy b/src/groovy/ShellExecutor.groovy index 9cc91b9..bdc69d6 100644 --- a/src/groovy/ShellExecutor.groovy +++ b/src/groovy/ShellExecutor.groovy @@ -24,10 +24,12 @@ class ShellExecutor { /** * Executes the given command using the shell in the supplied execution - * directory. + * directory. Normally this would be executed in a unix-like environment. + * In Windows this would be from something like a Git-Bash shell. * * @param command The command to run * @param edir The directory in which to run the command + * (execution directory) * @param pin The pipeline input directory * (used to define the PIN environment variable) * @param pout The pipeline output directory @@ -43,6 +45,16 @@ class ShellExecutor { StringBuilder sout = new StringBuilder() StringBuilder serr = new StringBuilder() + + // Windows/Git-Bash PIN/POUT path tweak... + String osName = System.properties['os.name'] + if (osName && osName.startsWith('Win')) { + pin = pin.replace('\\', '/') + pin = pin.replace('C:', '/c') + pout = pout.replace('\\', '/') + pout = pout.replace('C:', '/c') + } + // Append '/' to PIN and POUT to allow '${POUT}output' String cmd = "PIN=$pin/; POUT=$pout/; " + command def proc = ['sh', '-c', cmd].execute(null, edir)