From cf59785c417f76a1fddd6cd67baddd1188f31c7e Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Sun, 30 Jul 2017 00:35:41 -0700 Subject: [PATCH 1/2] Test some external repositories we care about So we know if we break something! These all need better verification scripts tho. --- .travis.yml | 4 ++- tests/conftest.py | 37 +++++++++++++++++++++---- tests/external/datasci.repos.yaml | 5 ++++ tests/external/reproductions.repos.yaml | 5 ++++ 4 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 tests/external/datasci.repos.yaml create mode 100644 tests/external/reproductions.repos.yaml diff --git a/.travis.yml b/.travis.yml index 625c2f2e..af52d6e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ python: install: - pip install -e . - - pip install pytest-xdist + - pip install pytest-xdist pyyaml script: # Run at least 4 tests in parallel. These tests are all fully @@ -19,3 +19,5 @@ env: - REPO_TYPE=venv - REPO_TYPE=julia - REPO_TYPE=dockerfile + - REPO_TYPE=external/datasci.repos.yaml + - REPO_TYPE=external/reproductions.repos.yaml diff --git a/tests/conftest.py b/tests/conftest.py index dc8a0a82..2d1e7acc 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,17 +9,20 @@ success. """ import pytest import subprocess +import yaml +import shlex def pytest_collect_file(parent, path): if path.basename == 'verify': - return Repo(path, parent) + return LocalRepo(path, parent) + elif path.basename.endswith('.repos.yaml'): + return RemoteRepoList(path, parent) -class Repo(pytest.File): +class LocalRepo(pytest.File): def collect(self): - yield RepoTest(self.fspath.basename, self, self.fspath) + yield LocalRepoTest(self.fspath.basename, self, self.fspath) - -class RepoTest(pytest.Item): +class LocalRepoTest(pytest.Item): def __init__(self, name, parent, path): super().__init__(name, parent) self.path = path @@ -30,3 +33,27 @@ class RepoTest(pytest.Item): str(self.path.dirname), './verify' ]) + + +class RemoteRepoList(pytest.File): + def collect(self): + with self.fspath.open() as f: + repos = yaml.safe_load(f) + for repo in repos: + yield RemoteRepoTest(repo['name'], self, repo['url'], repo['ref'], repo['verify']) + + +class RemoteRepoTest(pytest.Item): + def __init__(self, name, parent, url, ref, verify): + super().__init__(name, parent) + self.url = url + self.ref = ref + self.verify = verify + + def runtest(self): + subprocess.check_call([ + 'jupyter-repo2docker', + '--ref', self.ref, + self.url, + '--', + ] + shlex.split(self.verify)) diff --git a/tests/external/datasci.repos.yaml b/tests/external/datasci.repos.yaml new file mode 100644 index 00000000..aeeed4e0 --- /dev/null +++ b/tests/external/datasci.repos.yaml @@ -0,0 +1,5 @@ +# A bunch of external datascience related repos we care about! +- name: Jake's Data Science Book + url: https://github.com/jakevdp/PythonDataScienceHandbook + ref: de0cc6bd31 + verify: python -c 'import matplotlib' diff --git a/tests/external/reproductions.repos.yaml b/tests/external/reproductions.repos.yaml new file mode 100644 index 00000000..668424b2 --- /dev/null +++ b/tests/external/reproductions.repos.yaml @@ -0,0 +1,5 @@ +# A bunch of external repos that reproduce something cool we care about +- name: LIGO Gravitational Waves + url: https://github.com/minrk/ligo-binder/ + ref: b8259dac9eb + verify: python -c 'import matplotlib' From 54ad3df39ba55daf78e55912d77d47290f6a6e2b Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Sun, 30 Jul 2017 00:38:27 -0700 Subject: [PATCH 2/2] Run all external tests as one unit on Travis --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index af52d6e3..dd8f22a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,5 +19,4 @@ env: - REPO_TYPE=venv - REPO_TYPE=julia - REPO_TYPE=dockerfile - - REPO_TYPE=external/datasci.repos.yaml - - REPO_TYPE=external/reproductions.repos.yaml + - REPO_TYPE=external/*