Skip to content

Commit 75beeaf

Browse files
committed
docker
1 parent ed6a076 commit 75beeaf

File tree

6 files changed

+31
-105
lines changed

6 files changed

+31
-105
lines changed

docker/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM python:3.7.4-buster
2+
RUN apt-get -y update
3+
RUN apt-get install -y git vim emacs
4+
5+
WORKDIR /app
6+
RUN git clone https://github.com/kyclark/tiny_python_projects && python3 -m pip install -r /app/tiny_python_projects/requirements.txt
7+
8+
CMD ["python3", "--version"]

docker/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
TAG = kyclark/tiny_python_projects:0.1.0
2+
3+
img:
4+
docker build --tag=$(TAG) .
5+
6+
shell:
7+
docker run -it $(TAG) bash
8+
9+
push:
10+
docker push $(TAG)

docker/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Tiny Python Projects Docker
2+
3+
```
4+
$ docker pull kyclark/tiny_python_projects:0.1.0
5+
$ docker run -it --rm kyclark/tiny_python_projects:0.1.0 bash
6+
```

wod/silly-exercises.csv

Lines changed: 0 additions & 8 deletions
This file was deleted.

wod/solution.py

Lines changed: 0 additions & 89 deletions
This file was deleted.

wod/test.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from subprocess import getstatusoutput
77

88
prg = './wod.py'
9+
input1 = 'exercises.csv'
10+
input2 = 'silly-exercises.tab'
911

1012

1113
# --------------------------------------------------
@@ -20,7 +22,7 @@ def test_usage():
2022
"""usage"""
2123

2224
for flag in ['-h', '--help']:
23-
rv, out = getstatusoutput('{} {}'.format(prg, flag))
25+
rv, out = getstatusoutput(f'{prg} {flag}')
2426
assert rv == 0
2527
assert out.lower().startswith('usage')
2628

@@ -39,7 +41,7 @@ def test_runs01():
3941
"""
4042

4143
seed_flag = '-s' if random.choice([0, 1]) else '--seed'
42-
rv, out = getstatusoutput('{} {} {}'.format(prg, seed_flag, 1))
44+
rv, out = getstatusoutput(f'{prg} {seed_flag} 1')
4345
assert rv == 0
4446
assert out.strip() == expected.strip()
4547

@@ -59,8 +61,7 @@ def test_runs02():
5961

6062
seed_flag = '-s' if random.choice([0, 1]) else '--seed'
6163
easy_flag = '-e' if random.choice([0, 1]) else '--easy'
62-
rv, out = getstatusoutput('{} {} {} {}'.format(prg, easy_flag, seed_flag,
63-
1))
64+
rv, out = getstatusoutput(f'{prg} {easy_flag} {seed_flag} 1')
6465
assert rv == 0
6566
assert out.strip() == expected.strip()
6667

@@ -84,8 +85,7 @@ def test_runs03():
8485

8586
seed_flag = '-s' if random.choice([0, 1]) else '--seed'
8687
num_flag = '-n' if random.choice([0, 1]) else '--num_exercises'
87-
rv, out = getstatusoutput('{} {} 8 {} 2 -f wod.csv'.format(
88-
prg, num_flag, seed_flag))
88+
rv, out = getstatusoutput(f'{prg} {num_flag} 8 {seed_flag} 2 -f {input1}')
8989
assert rv == 0
9090
assert out.strip() == expected.strip()
9191

@@ -104,7 +104,6 @@ def test_runs04():
104104

105105
seed_flag = '-s' if random.choice([0, 1]) else '--seed'
106106
num_flag = '-n' if random.choice([0, 1]) else '--num_exercises'
107-
rv, out = getstatusoutput('{} {} 3 {} 4 -f wod2.csv'.format(
108-
prg, num_flag, seed_flag))
107+
rv, out = getstatusoutput(f'{prg} {num_flag} 3 {seed_flag} 4 -f {input2}')
109108
assert rv == 0
110109
assert out.strip() == expected.strip()

0 commit comments

Comments
 (0)