kopia lustrzana https://github.com/jupyterhub/repo2docker
commit
4e174313f0
|
@ -9,6 +9,8 @@ MANIFEST
|
|||
|
||||
.DS_Store
|
||||
.cache
|
||||
.coverage
|
||||
htmlcov
|
||||
|
||||
repo2docker/s2i
|
||||
|
||||
|
|
25
.travis.yml
25
.travis.yml
|
@ -1,20 +1,25 @@
|
|||
language: python
|
||||
sudo: required
|
||||
cache: pip
|
||||
services:
|
||||
- docker
|
||||
python:
|
||||
- 3.4
|
||||
- 3.6
|
||||
install:
|
||||
# Make a wheel and install it to test to catch possible
|
||||
# issues with MANIFEST.in
|
||||
- pip install --no-cache-dir -r dev-requirements.txt
|
||||
- python setup.py bdist_wheel
|
||||
- pip install dist/*.whl
|
||||
# Make a wheel and install it to test to catch possible
|
||||
# issues with releases
|
||||
- pip install --upgrade setuptools pip
|
||||
- pip install -r dev-requirements.txt
|
||||
- python setup.py bdist_wheel
|
||||
- pip install dist/*.whl
|
||||
|
||||
script:
|
||||
# cd into tests so CWD being repo2docker does not hide
|
||||
# possible issues with MANIFEST.in
|
||||
- cd tests && pytest -s -v ${REPO_TYPE}
|
||||
- cd tests && pytest --cov repo2docker -v ${REPO_TYPE}
|
||||
after_success:
|
||||
- pip install codecov
|
||||
- codecov
|
||||
|
||||
jobs:
|
||||
include:
|
||||
|
@ -42,3 +47,9 @@ env:
|
|||
- secure: gX7IOkbjlvcDwIH24sOLhutINx6TZRwujEusMWh1dqgYG2D69qQai/mTrRXO9PGRrsvQwIBk4RcILKAiZnk5O2Z1hLoIHk/oU2mNUmE44dDm4Xf/VTTdeYhjeOTR9B+KJ9NVwPxuSEDSND3lD7yFfvCqNXykipEhBtTliLupjWVxxXnaz0aZTYHUPJwanxdUc06AphSPwZjtm1m3qMUU8v7UdTGGAdW3NlgkKw0Xx2x5W31fW676vskC/GNQAbcRociYipuhSFWV4lu+6d8XF2xVO97xtzf54tBQzt6RgVfAKtiqkEIYSzJQBBpkQ6SM6yg+fQoQpOo8jPU9ZBjvaoopUG9v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jlvFmQqVwPPBfnp5Dudna2RQFF36eO2jUlISBkvK/q/GRmOQbjpAJRtVlan8Z4dlIf4az/oQ9G0ZUEfgUliVvS5MTrEPvKej3znug2zAH1t+H0U6aon1VJeVC+b94jsETGvQ7HHupqrr+DNGrNVHOgAazw7z4j+VtfZyfNaglnrKwYPeUljw3GIOXyFmP81t/cLiDY+IjPPepUYJFQIjCoVpIDm6UR70d4mzWf/LYWONEdh8LhDJZ2UyEtnUT2IPTdhqem1BfCAKUcLedHPk3S4Lcn0jL23os0klHeQvn9JRPEDV/Ib33XGcNEIXZi0pBkluUyhx8JgTz4e+KL8jKcyf9TRX7o/ViH7Ler6viliyMu15yfs2mJKAxzw6GFMtqGzhJ8tUXjguTozfjKTJKjBpkFoYdYbO9GqNkBQo2F7H+8zAmb4D4K0jzfOo8owjYLXJzOMJN5f5pKBqfLdjOtTxve4PrCgy4B8x7GDkW41SuRz2pkVwRDMMJRCetLcbqpEK+8b9Oy/inlxt7/56oS/tvvAtBj2FlLGBPQJKpwyZozIY9XqXWu8u+VbRsSTqbRtdSHzzKyQ25a03dc7KDHmyoDAlzyehe6cHPWp1UqXg=
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- python: 3.4
|
||||
env:
|
||||
- REPO_TYPE=venv
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
pyyaml
|
||||
pytest
|
||||
wheel
|
||||
pytest-cov
|
||||
|
|
|
@ -320,8 +320,10 @@ class Repo2Docker(Application):
|
|||
exc_info=(etype, evalue, traceback),
|
||||
extra=dict(phase='failed'))
|
||||
|
||||
def initialize(self):
|
||||
args = self.get_argparser().parse_args()
|
||||
def initialize(self, argv=None):
|
||||
if argv is None:
|
||||
argv = sys.argv[1:]
|
||||
args = self.get_argparser().parse_args(argv)
|
||||
|
||||
if args.debug:
|
||||
self.log_level = logging.DEBUG
|
||||
|
@ -500,7 +502,8 @@ class Repo2Docker(Application):
|
|||
container.kill()
|
||||
exit_code = container.attrs['State']['ExitCode']
|
||||
container.remove()
|
||||
sys.exit(exit_code)
|
||||
if exit_code:
|
||||
sys.exit(exit_code)
|
||||
|
||||
def _get_free_port(self):
|
||||
"""
|
||||
|
|
|
@ -7,11 +7,16 @@ 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
|
||||
import yaml
|
||||
|
||||
import os
|
||||
import pipes
|
||||
import shlex
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from repo2docker.app import Repo2Docker
|
||||
|
||||
|
||||
def pytest_collect_file(parent, path):
|
||||
if path.basename == 'verify':
|
||||
|
@ -20,22 +25,45 @@ def pytest_collect_file(parent, path):
|
|||
return RemoteRepoList(path, parent)
|
||||
|
||||
|
||||
def make_test_func(args):
|
||||
"""Generate a test function that runs repo2docker"""
|
||||
def test():
|
||||
app = Repo2Docker()
|
||||
app.initialize(args)
|
||||
app.start()
|
||||
return test
|
||||
|
||||
|
||||
class Repo2DockerTest(pytest.Function):
|
||||
"""A pytest.Item for running repo2docker"""
|
||||
def __init__(self, name, parent, args):
|
||||
self.args = args
|
||||
self.save_cwd = os.getcwd()
|
||||
f = parent.obj = make_test_func(args)
|
||||
super().__init__(name, parent, callobj=f)
|
||||
|
||||
def reportinfo(self):
|
||||
return self.parent.fspath, None, ""
|
||||
|
||||
def repr_failure(self, excinfo):
|
||||
err = excinfo.value
|
||||
if isinstance(err, SystemExit):
|
||||
cmd = "jupyter-repo2docker %s" % ' '.join(map(pipes.quote, self.args))
|
||||
return "%s | exited with status=%s" % (cmd, err.code)
|
||||
else:
|
||||
return super().repr_failure(excinfo)
|
||||
|
||||
def teardown(self):
|
||||
super().teardown()
|
||||
os.chdir(self.save_cwd)
|
||||
|
||||
|
||||
class LocalRepo(pytest.File):
|
||||
def collect(self):
|
||||
yield LocalRepoTest(self.fspath.basename, self, self.fspath)
|
||||
|
||||
|
||||
class LocalRepoTest(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'
|
||||
])
|
||||
yield Repo2DockerTest(
|
||||
self.fspath.basename, self,
|
||||
args=[self.fspath.dirname, './verify'],
|
||||
)
|
||||
|
||||
|
||||
class RemoteRepoList(pytest.File):
|
||||
|
@ -43,21 +71,11 @@ class RemoteRepoList(pytest.File):
|
|||
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))
|
||||
yield Repo2DockerTest(
|
||||
repo['name'], self,
|
||||
args=[
|
||||
'--ref', repo['ref'],
|
||||
repo['url'],
|
||||
'--',
|
||||
] + shlex.split(repo['verify']),
|
||||
)
|
||||
|
|
Ładowanie…
Reference in New Issue