kopia lustrzana https://github.com/jupyterhub/repo2docker
run check-tmp as root
- avoids permission errors - lets us check /root/ where we've left files in the pastpull/1126/head
rodzic
6b0291551d
commit
bd02e2e997
|
@ -25,10 +25,12 @@ MB = 1024 * 1024
|
||||||
# missing is okay
|
# missing is okay
|
||||||
PATHS = [
|
PATHS = [
|
||||||
"/tmp/",
|
"/tmp/",
|
||||||
|
# check whole home?
|
||||||
|
# this shouldn't be empty, but for our tests (so far) it should be very small
|
||||||
|
# This is the easiest way to ensure we aren't leaving any unexpected files
|
||||||
|
# without knowing ahead of time where all possible caches might be (.npm, .cache, etc.)
|
||||||
"~/",
|
"~/",
|
||||||
"~/.cache/",
|
"/root/",
|
||||||
# not running with read permissions on root
|
|
||||||
# "/root/",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,14 @@ def pytest_collect_file(parent, path):
|
||||||
return RemoteRepoList.from_parent(parent, fspath=path)
|
return RemoteRepoList.from_parent(parent, fspath=path)
|
||||||
|
|
||||||
|
|
||||||
def make_test_func(args, skip_build=False):
|
def make_test_func(args, skip_build=False, extra_run_kwargs=None):
|
||||||
"""Generate a test function that runs repo2docker"""
|
"""Generate a test function that runs repo2docker"""
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
app = make_r2d(args)
|
app = make_r2d(args)
|
||||||
app.initialize()
|
app.initialize()
|
||||||
|
if extra_run_kwargs:
|
||||||
|
app.extra_run_kwargs.update(extra_run_kwargs)
|
||||||
if skip_build:
|
if skip_build:
|
||||||
|
|
||||||
def build_noop():
|
def build_noop():
|
||||||
|
@ -193,10 +195,14 @@ def repo_with_submodule():
|
||||||
class Repo2DockerTest(pytest.Function):
|
class Repo2DockerTest(pytest.Function):
|
||||||
"""A pytest.Item for running repo2docker"""
|
"""A pytest.Item for running repo2docker"""
|
||||||
|
|
||||||
def __init__(self, name, parent, args=None, skip_build=False):
|
def __init__(
|
||||||
|
self, name, parent, args=None, skip_build=False, extra_run_kwargs=None
|
||||||
|
):
|
||||||
self.args = args
|
self.args = args
|
||||||
self.save_cwd = os.getcwd()
|
self.save_cwd = os.getcwd()
|
||||||
f = parent.obj = make_test_func(args, skip_build=skip_build)
|
f = parent.obj = make_test_func(
|
||||||
|
args, skip_build=skip_build, extra_run_kwargs=extra_run_kwargs
|
||||||
|
)
|
||||||
super().__init__(name, parent, callobj=f)
|
super().__init__(name, parent, callobj=f)
|
||||||
|
|
||||||
def reportinfo(self):
|
def reportinfo(self):
|
||||||
|
@ -254,6 +260,7 @@ class LocalRepo(pytest.File):
|
||||||
name="check-tmp",
|
name="check-tmp",
|
||||||
args=check_tmp_args,
|
args=check_tmp_args,
|
||||||
skip_build=True,
|
skip_build=True,
|
||||||
|
extra_run_kwargs={"user": "root"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue