Add simple python test for --repo-path

extra-args.yaml placed in a test directory can be used
to pass extra arguments to the repo2docker command.
pull/507/head
yuvipanda 2018-12-17 16:12:19 -08:00
rodzic 4858f42d7f
commit 66f025720e
4 zmienionych plików z 35 dodań i 9 usunięć

Wyświetl plik

@ -103,20 +103,26 @@ class Repo2DockerTest(pytest.Function):
class LocalRepo(pytest.File):
def collect(self):
args = [
'--appendix', 'RUN echo "appendix" > /tmp/appendix',
]
# If there's an extra-args.yaml file in a test dir, assume it contains
# a yaml list with extra arguments to be passed to repo2docker
extra_args_path = os.path.join(self.fspath.dirname, 'extra-args.yaml')
if os.path.exists(extra_args_path):
with open(extra_args_path) as f:
extra_args = yaml.safe_load(f)
args += extra_args
args.append(self.fspath.dirname)
yield Repo2DockerTest(
'build', self,
args=[
'--appendix', 'RUN echo "appendix" > /tmp/appendix',
self.fspath.dirname,
],
args=args
)
yield Repo2DockerTest(
self.fspath.basename, self,
args=[
'--appendix', 'RUN echo "appendix" > /tmp/appendix',
self.fspath.dirname,
'./verify',
],
args=args + ['./verify']
)

Wyświetl plik

@ -0,0 +1,8 @@
Python - Custom Repository Location
-----------------------------------
We want to support custom paths where repositories can be
copied to, instead of ${HOME}. The `extra-args.yaml` file in
each dir can contain a list of arguments that are passed
to repo2docker during the test. We copy this repo to
/srv/repo instead of ${HOME}

Wyświetl plik

@ -0,0 +1,2 @@
- --repo-path
- /srv/repo

Wyświetl plik

@ -0,0 +1,10 @@
#!/usr/bin/env python
import sys
import os
# Python should still be in /srv/conda
assert sys.executable == '/srv/conda/bin/python'
# Repo should be in /srv/repo
assert os.path.exists('/srv/repo/verify')
assert os.path.abspath(__file__) == '/srv/repo/verify'