Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a test harness #5

Merged
merged 8 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed Lib/.gitkeep
Empty file.
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
3 changes: 0 additions & 3 deletions Test/README.md

This file was deleted.

19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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"
24 changes: 24 additions & 0 deletions docker/test/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
1 change: 1 addition & 0 deletions python/src/timeSeries/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.0.1'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions python/templates/module/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.0.0'
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions python/tests/timeSeries/readUnrTxyz2_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import sys
sys.path.append("./src")

import timeSeries as ts

def test_readUnrTxyz2():
assert True == True
5 changes: 5 additions & 0 deletions shell/python-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# initialize Anaconda
. /opt/conda/bin/activate

# Run our test suite
pytest