Skip to content

Commit

Permalink
split tests container from the runner one
Browse files Browse the repository at this point in the history
  • Loading branch information
sph3rex committed Jul 2, 2019
1 parent 6bf7dbf commit b18bb74
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
10 changes: 10 additions & 0 deletions docker/Dockerfile.tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.6.8-jessie

ADD ./requirements.no-gpu.txt /code/
ADD ./requirements.tests.txt /code/requirements.txt

WORKDIR /code

RUN apt-get update \
&& apt-get install -y build-essential mpich \
&& pip install -r requirements.txt
2 changes: 2 additions & 0 deletions requirements.tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r requirements.no-cpu.txt
pytest
4 changes: 2 additions & 2 deletions run-tests-with-docker
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
CWD=$(realpath "${SCRIPT_DIR}")

N="btcoin-trader-rl-cpu"
docker build --tag $N -f docker/Dockerfile.cpu "$CWD"
docker build --tag $N -f docker/Dockerfile.tests "$CWD"

docker run \
--user $(id -u):$(id -g) \
--interactive \
--tty \
--volume "${CWD}":/code \
"$N" \
python -m unittest discover
python -m pytest -p no:warnings
7 changes: 4 additions & 3 deletions test/data/test_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
@pytest.fixture
def csv_provider():
data_columns = {'Date': 'Date', 'Open': 'Open', 'High': 'High',
'Low': 'Low', 'Close': 'Close', 'Volume': 'Volume BTC'}
'Low': 'Low', 'Close': 'Close', 'Volume': 'VolumeFrom'}
provider = StaticDataProvider(
date_format=ProviderDateFormat.DATETIME_HOUR_12, csv_data_path="data/input/coinbase_hourly.csv", data_columns=data_columns)
date_format=ProviderDateFormat.DATETIME_HOUR_24, csv_data_path="coinbase-1h-btc-usd.csv", data_columns=data_columns
)

assert csv_provider is not None

Expand All @@ -21,7 +22,7 @@ def test_column_map(self, csv_provider):
ohlcv = csv_provider.historical_ohlcv()

expected = ['Date', 'Open', 'High',
'Low', 'Close', 'Volume', 'Timestamp']
'Low', 'Close', 'Volume']

assert (ohlcv.columns == expected).all()

Expand Down
2 changes: 1 addition & 1 deletion test/test_rl_trader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def setUp(self):

def test_that_args_get_injected_correctly(self):
args = self.parser.parse_args(['optimize'])
sut = RLTrader(args)
sut = RLTrader(**vars(args))

self.assertEqual(sut.tensorboard_path, args.tensorboard_path)
self.assertEqual(sut.params_db_path, args.params_db_path)
Expand Down

0 comments on commit b18bb74

Please sign in to comment.