Skip to content

Commit 680546d

Browse files
Move to pytest and get rid of pipenv.
1 parent 32b9e06 commit 680546d

13 files changed

+277
-218
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,6 @@ environment.yaml
115115

116116
# Word embedding cache
117117
/.vector_cache
118+
119+
# Test cache
120+
/.pytest_cache

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test:
2+
pytest .

requirements.txt

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
atari-py==0.1.7
2+
atomicwrites==1.3.0
3+
attrs==19.1.0
4+
bleach==3.1.0
5+
box2d-py==2.3.8
6+
certifi==2019.3.9
7+
chardet==3.0.4
8+
cloudpickle==0.8.0
9+
cymem==2.0.2
10+
cytoolz==0.9.0.1
11+
dill==0.2.9
12+
dnspython==1.16.0
13+
docutils==0.14
14+
future==0.17.1
15+
gym==0.12.0
16+
idna==2.8
17+
more-itertools==6.0.0
18+
msgpack==0.5.6
19+
msgpack-numpy==0.4.3.2
20+
murmurhash==1.0.2
21+
numpy==1.16.2
22+
opencv-python==4.0.0.21
23+
pandas==0.24.1
24+
Pillow==5.4.1
25+
pkginfo==1.5.0.1
26+
plac==0.9.6
27+
pluggy==0.9.0
28+
preshed==2.0.1
29+
py==1.8.0
30+
pyglet==1.3.2
31+
Pygments==2.3.1
32+
pymongo==3.7.2
33+
PyOpenGL==3.1.0
34+
pytest==4.3.1
35+
python-dateutil==2.8.0
36+
pytz==2018.9
37+
PyYAML==5.1
38+
pyzmq==18.0.1
39+
readme-renderer==24.0
40+
regex==2018.1.10
41+
requests==2.21.0
42+
requests-toolbelt==0.9.1
43+
scikit-learn==0.20.3
44+
scipy==1.2.1
45+
six==1.12.0
46+
spacy==2.0.18
47+
thinc==6.12.1
48+
toolz==0.9.0
49+
torch==1.0.1.post2
50+
torchfile==0.1.0
51+
torchtext==0.3.1
52+
torchvision==0.2.2.post3
53+
tornado==6.0.1
54+
tqdm==4.31.1
55+
twine==1.13.0
56+
ujson==1.35
57+
urllib3==1.24.1
58+
visdom==0.1.8.8
59+
webencodings==0.5.1
60+
websocket-client==0.55.0
61+
wrapt==1.10.11

setup.cfg

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[metadata]
2-
description-file = README.md
2+
description-file = README.md
3+
4+
[aliases]
5+
test=pytest

setup.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
setup(
1818
name='vel',
19-
version='0.2.2',
19+
version='0.3.0',
2020
description="Velocity in deep-learning research",
2121
long_description=long_description,
2222
url='https://github.com/MillionIntegrals/vel',
@@ -33,7 +33,7 @@
3333
'pandas',
3434
'pyyaml',
3535
'scikit-learn',
36-
'torch == 1.0',
36+
'torch ~= 1.0',
3737
'torchvision',
3838
'torchtext',
3939
'tqdm'
@@ -43,9 +43,13 @@
4343
'mongo': ['pymongo', 'dnspython'],
4444
'gym': ['gym[atari,box2d,classic_control]'],
4545
'mujoco': ['gym[mujoco,robotics]'],
46-
'dev': ['nose'],
47-
'text': ['spacy']
46+
'dev': ['pytest'],
47+
'text': ['spacy'],
48+
'all': ['visdom', 'pymongo', 'dnspython', 'gym[all]', 'pytest', 'spacy']
4849
},
50+
tests_require=[
51+
'pytest'
52+
],
4953
entry_points={
5054
'console_scripts': [
5155
'vel = vel.launcher:main',

travis-requirements.txt

+39-47
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,61 @@
11
atari-py==0.1.7
2-
attrs==18.2.0
3-
bleach==3.0.2
4-
Box2D==2.3.2
2+
atomicwrites==1.3.0
3+
attrs==19.1.0
4+
bleach==3.1.0
55
box2d-py==2.3.8
6-
certifi==2018.10.15
7-
cffi==1.11.5
6+
certifi==2019.3.9
87
chardet==3.0.4
9-
cloudpickle==0.6.1
10-
cycler==0.10.0
8+
cloudpickle==0.8.0
119
cymem==2.0.2
12-
Cython==0.29.1
1310
cytoolz==0.9.0.1
14-
dill==0.2.8.2
15-
dnspython==1.15.0
11+
dill==0.2.9
12+
dnspython==1.16.0
1613
docutils==0.14
1714
future==0.17.1
18-
glfw==1.7.0
19-
gym==0.10.9
20-
idna==2.7
21-
imageio==2.4.1
22-
kiwisolver==1.0.1
23-
lockfile==0.12.2
24-
matplotlib==3.0.2
15+
gym==0.12.0
16+
idna==2.8
17+
more-itertools==6.0.0
2518
msgpack==0.5.6
2619
msgpack-numpy==0.4.3.2
27-
murmurhash==1.0.1
28-
nose==1.3.7
29-
numpy==1.15.4
30-
opencv-python==3.4.3.18
31-
pandas==0.23.4
32-
Pillow==5.3.0
33-
Pillow-SIMD==5.3.0.post0
34-
pkginfo==1.4.2
20+
murmurhash==1.0.2
21+
numpy==1.16.2
22+
opencv-python==4.0.0.21
23+
pandas==0.24.1
24+
Pillow==5.4.1
25+
pkginfo==1.5.0.1
3526
plac==0.9.6
27+
pluggy==0.9.0
3628
preshed==2.0.1
37-
pycparser==2.19
29+
py==1.8.0
3830
pyglet==1.3.2
39-
Pygments==2.2.0
31+
Pygments==2.3.1
4032
pymongo==3.7.2
4133
PyOpenGL==3.1.0
42-
pyparsing==2.3.0
43-
python-dateutil==2.7.5
44-
pytz==2018.7
45-
PyYAML==3.13
46-
pyzmq==17.1.2
34+
pytest==4.3.1
35+
python-dateutil==2.8.0
36+
pytz==2018.9
37+
PyYAML==5.1
38+
pyzmq==18.0.1
4739
readme-renderer==24.0
48-
regex==2017.11.9
49-
requests==2.20.1
50-
requests-toolbelt==0.8.0
51-
scikit-learn==0.20.1
52-
scipy==1.1.0
53-
six==1.11.0
54-
spacy==2.0.17
55-
thinc==6.12.0
40+
regex==2018.1.10
41+
requests==2.21.0
42+
requests-toolbelt==0.9.1
43+
scikit-learn==0.20.3
44+
scipy==1.2.1
45+
six==1.12.0
46+
spacy==2.0.18
47+
thinc==6.12.1
5648
toolz==0.9.0
57-
torch==0.4.1
49+
torch==1.0.1.post2
5850
torchfile==0.1.0
5951
torchtext==0.3.1
60-
torchvision==0.2.1
61-
tornado==5.1.1
62-
tqdm==4.28.1
63-
twine==1.12.1
52+
torchvision==0.2.2.post3
53+
tornado==6.0.1
54+
tqdm==4.31.1
55+
twine==1.13.0
6456
ujson==1.35
6557
urllib3==1.24.1
66-
visdom==0.1.8.5
58+
visdom==0.1.8.8
6759
webencodings==0.5.1
68-
websocket-client==0.54.0
60+
websocket-client==0.55.0
6961
wrapt==1.10.11

vel/internals/tests/test_parser.py

+19-28
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,47 @@
1-
import nose.tools as t
1+
import pytest
22

33
import vel.internals.parser as v
44

55

6+
@pytest.fixture
67
def setup_parser():
78
""" Set up test environment """
89
v.Parser.register()
910

1011

11-
@t.with_setup(setup_parser)
12-
def test_variable_parsing():
13-
v.Parser.register()
14-
12+
def test_variable_parsing(setup_parser):
1513
yaml_text = """
1614
x:
1715
y: !param xxx
1816
"""
1917

2018
yaml_contents = v.Parser.parse(yaml_text)
2119

22-
t.assert_is_instance(yaml_contents['x']['y'], v.Parameter)
23-
t.assert_equal(yaml_contents['x']['y'].name, 'xxx')
20+
assert isinstance(yaml_contents['x']['y'], v.Parameter)
21+
assert yaml_contents['x']['y'].name == 'xxx'
2422

2523

26-
@t.with_setup(setup_parser)
27-
def test_env_variable_parsing():
28-
v.Parser.register()
29-
24+
def test_env_variable_parsing(setup_parser):
3025
yaml_text = """
3126
x:
3227
y: !env xxx
3328
"""
3429

3530
yaml_contents = v.Parser.parse(yaml_text)
3631

37-
t.assert_is_instance(yaml_contents['x']['y'], v.EnvironmentVariable)
38-
t.assert_equal(yaml_contents['x']['y'].name, 'xxx')
32+
assert isinstance(yaml_contents['x']['y'], v.EnvironmentVariable)
33+
assert yaml_contents['x']['y'].name == 'xxx'
3934

4035

41-
@t.with_setup(setup_parser)
42-
def test_variable_default_values():
43-
v.Parser.register()
44-
36+
def test_variable_default_values(setup_parser):
4537
yaml_text = """
4638
x:
4739
y: !param xxx = 5
4840
"""
4941

5042
yaml_contents = v.Parser.parse(yaml_text)
5143

52-
t.assert_equal(yaml_contents['x']['y'].default_value, 5)
44+
assert yaml_contents['x']['y'].default_value == 5
5345

5446
yaml_text = """
5547
x:
@@ -58,7 +50,7 @@ def test_variable_default_values():
5850

5951
yaml_contents = v.Parser.parse(yaml_text)
6052

61-
t.assert_equal(yaml_contents['x']['y'].default_value, 'abc')
53+
assert yaml_contents['x']['y'].default_value == 'abc'
6254

6355
yaml_text = """
6456
x:
@@ -67,7 +59,7 @@ def test_variable_default_values():
6759

6860
yaml_contents = v.Parser.parse(yaml_text)
6961

70-
t.assert_equal(yaml_contents['x']['y'].default_value, 'abc def')
62+
assert yaml_contents['x']['y'].default_value == 'abc def'
7163

7264
yaml_text = """
7365
x:
@@ -76,7 +68,7 @@ def test_variable_default_values():
7668

7769
yaml_contents = v.Parser.parse(yaml_text)
7870

79-
t.assert_equal(yaml_contents['x']['y'].default_value, None)
71+
assert yaml_contents['x']['y'].default_value == None
8072

8173
yaml_text = """
8274
x:
@@ -85,16 +77,15 @@ def test_variable_default_values():
8577

8678
yaml_contents = v.Parser.parse(yaml_text)
8779

88-
t.assert_equal(yaml_contents['x']['y'].default_value, v.DUMMY_VALUE)
80+
assert yaml_contents['x']['y'].default_value == v.DUMMY_VALUE
8981

9082

9183
def test_parse_equality():
92-
t.assert_equal(v.Parser.parse_equality("x=5"), ('x', 5))
93-
t.assert_equal(v.Parser.parse_equality(" x = 5 "), ('x', 5))
84+
assert v.Parser.parse_equality("x=5") == ('x', 5)
85+
assert v.Parser.parse_equality(" x = 5 ") == ('x', 5)
9486

95-
with t.assert_raises(AssertionError):
87+
with pytest.raises(AssertionError):
9688
v.Parser.parse_equality(" 1 = 2 ")
9789

98-
t.assert_equal(v.Parser.parse_equality(" 'asd' = 'www zzz' "), ('asd', 'www zzz'))
99-
100-
t.assert_equal(v.Parser.parse_equality(" 'asd' = 'www=zzz' "), ('asd', 'www=zzz'))
90+
assert v.Parser.parse_equality(" 'asd' = 'www zzz' ") == ('asd', 'www zzz')
91+
assert v.Parser.parse_equality(" 'asd' = 'www=zzz' ") == ('asd', 'www=zzz')

0 commit comments

Comments
 (0)