run check-tmp as root

- avoids permission errors
- lets us check /root/ where we've left files in the past
pull/1126/head
Min RK 2022-01-27 10:09:45 +01:00
rodzic 6b0291551d
commit bd02e2e997
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 809C6E46EAA899F4
2 zmienionych plików z 15 dodań i 6 usunięć

Wyświetl plik

@ -25,10 +25,12 @@ MB = 1024 * 1024
# missing is okay
PATHS = [
"/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/",
# not running with read permissions on root
# "/root/",
"/root/",
]

Wyświetl plik

@ -41,12 +41,14 @@ def pytest_collect_file(parent, 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"""
def test():
app = make_r2d(args)
app.initialize()
if extra_run_kwargs:
app.extra_run_kwargs.update(extra_run_kwargs)
if skip_build:
def build_noop():
@ -193,10 +195,14 @@ def repo_with_submodule():
class Repo2DockerTest(pytest.Function):
"""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.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)
def reportinfo(self):
@ -254,6 +260,7 @@ class LocalRepo(pytest.File):
name="check-tmp",
args=check_tmp_args,
skip_build=True,
extra_run_kwargs={"user": "root"},
)