Add integration tests!

We run jupyter-repo2docker and verify that the things we
expect to be installed are installed.
pull/42/head
yuvipanda 2017-07-29 16:05:26 -07:00
rodzic ad43fa3aab
commit 514ab7d985
6 zmienionych plików z 48 dodań i 0 usunięć

32
tests/conftest.py 100644
Wyświetl plik

@ -0,0 +1,32 @@
"""
Custom test collector for our integration tests.
Each directory that has a script named 'verify' is considered
a test. jupyter-repo2docker is run on that directory,
and then ./verify is run inside the built container. It should
return a non-zero exit code for the test to be considered a
success.
"""
import pytest
import subprocess
def pytest_collect_file(parent, path):
if path.basename == 'verify':
return Repo(path, parent)
class Repo(pytest.File):
def collect(self):
yield RepoTest(self.fspath.basename, self, self.fspath)
class RepoTest(pytest.Item):
def __init__(self, name, parent, path):
super().__init__(name, parent)
self.path = path
def runtest(self):
subprocess.check_call([
'jupyter-repo2docker',
str(self.path.dirname),
'./verify'
])

Wyświetl plik

@ -0,0 +1 @@
numpy

Wyświetl plik

@ -0,0 +1,6 @@
#!/usr/bin/env python
import sys
assert sys.version_info[:2] == (3, 5)
import numpy

Wyświetl plik

@ -0,0 +1 @@
numpy

Wyświetl plik

@ -0,0 +1 @@
python-2.7

Wyświetl plik

@ -0,0 +1,7 @@
#!/usr/bin/env python2
import sys
print(sys.version_info)
assert sys.version_info[:2] == (2, 7)
import numpy