diff --git a/Lib/.gitkeep b/Lib/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c13bd53 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +# This marks the "test" target as 'phony', which means that it isn't based on actual +# files. Make has a ton of magic in it, and one of the bits of magic is it won't +# rebuild a target if it doesn't think any of its dependencies have changed. Phony +# means its not based on on-disk targets, so always build it when invoked +.PHONY: test + +# The test target makes sure all docker images are up to date and runs the test +# suite +test: + docker-compose down && docker-compose build test && docker-compose run test && docker-compose down diff --git a/Test/README.md b/Test/README.md deleted file mode 100644 index 0d47d64..0000000 --- a/Test/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Unit Test Directory - -Directory with unit tests for TSTools modules. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d99bbbd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +# The full docker-compose spec is available here: https://docs.docker.com/compose/compose-file/#reference-and-guidelines +version: '3' + +# docker-compose allows you to bundle a bunch of docker concepts together into +# a unit that all needs to be run at this same time. This could be many containers, +# volumes, or the networking between them all. +services: + + # our test service is the image built specifically to run our test environment, + # and if we ever get CI/CD setup it will be what we run + test: + build: + context: . + dockerfile: docker/test/Dockerfile + + # we unfortunately can't invode "pytest" directly due to some weirdness with + # how Ananaconda sets up environments, so we use a wrapper script. This is + # run inside the docker container when it boots up + command: "./test.sh" diff --git a/docker/test/Dockerfile b/docker/test/Dockerfile new file mode 100644 index 0000000..18680d4 --- /dev/null +++ b/docker/test/Dockerfile @@ -0,0 +1,24 @@ +# This is the official Ananaconda Dockerfile maintained by ContinuumIO. At some point +# we will probably want to peg this to a specific version that TSTools supports +FROM continuumio/anaconda3 + +# Create a directory for our code +RUN mkdir -p /tstools + +# Copy in the Library code +COPY ./python/src /tstools/src + +# Copy in the test code +COPY ./python/tests /tstools/tests + +# Tell Docker that we want to do the rest of our work from this directory +WORKDIR /tstools + +# Copy in our test harness +COPY ./shell/python-tests.sh ./test.sh + +# Make our test runner executable in the Docker container (not the local one) +RUN chmod +x ./test.sh + +# Set Bash as our entry +ENTRYPOINT [ "/bin/bash" ] diff --git a/python/src/timeSeries/__init__.py b/python/src/timeSeries/__init__.py new file mode 100644 index 0000000..b8023d8 --- /dev/null +++ b/python/src/timeSeries/__init__.py @@ -0,0 +1 @@ +__version__ = '0.0.1' diff --git a/Lib/timeSeries.py b/python/src/timeSeries/timeSeries.py similarity index 100% rename from Lib/timeSeries.py rename to python/src/timeSeries/timeSeries.py diff --git a/Lib/transform.py b/python/src/timeSeries/transform.py similarity index 100% rename from Lib/transform.py rename to python/src/timeSeries/transform.py diff --git a/Templates/README.md b/python/templates/README.md similarity index 100% rename from Templates/README.md rename to python/templates/README.md diff --git a/Templates/fitFile_temp.cmd b/python/templates/fitFile_temp.cmd similarity index 100% rename from Templates/fitFile_temp.cmd rename to python/templates/fitFile_temp.cmd diff --git a/Templates/fitFile_temp.py b/python/templates/fitFile_temp.py similarity index 100% rename from Templates/fitFile_temp.py rename to python/templates/fitFile_temp.py diff --git a/python/templates/module/__init__.py b/python/templates/module/__init__.py new file mode 100644 index 0000000..6853c36 --- /dev/null +++ b/python/templates/module/__init__.py @@ -0,0 +1 @@ +__version__ = '0.0.0' \ No newline at end of file diff --git a/Templates/module_temp.py b/python/templates/module/module_temp.py similarity index 100% rename from Templates/module_temp.py rename to python/templates/module/module_temp.py diff --git a/Templates/program_temp.py b/python/templates/program_temp.py similarity index 100% rename from Templates/program_temp.py rename to python/templates/program_temp.py diff --git a/Test/timeSeries/AREQ.IGS08.txyz2 b/python/tests/timeSeries/AREQ.IGS08.txyz2 similarity index 100% rename from Test/timeSeries/AREQ.IGS08.txyz2 rename to python/tests/timeSeries/AREQ.IGS08.txyz2 diff --git a/Test/timeSeries/Html/AREQ.IGS08.dXdYdZ.html b/python/tests/timeSeries/Html/AREQ.IGS08.dXdYdZ.html similarity index 100% rename from Test/timeSeries/Html/AREQ.IGS08.dXdYdZ.html rename to python/tests/timeSeries/Html/AREQ.IGS08.dXdYdZ.html diff --git a/python/tests/timeSeries/readUnrTxyz2_test.py b/python/tests/timeSeries/readUnrTxyz2_test.py new file mode 100644 index 0000000..d4023a1 --- /dev/null +++ b/python/tests/timeSeries/readUnrTxyz2_test.py @@ -0,0 +1,7 @@ +import sys +sys.path.append("./src") + +import timeSeries as ts + +def test_readUnrTxyz2(): + assert True == True diff --git a/shell/python-tests.sh b/shell/python-tests.sh new file mode 100644 index 0000000..a91863f --- /dev/null +++ b/shell/python-tests.sh @@ -0,0 +1,5 @@ +# initialize Anaconda +. /opt/conda/bin/activate + +# Run our test suite +pytest