test: make tests run without root access (#3968)

This commit is contained in:
Nicolas Giard 2022-05-14 09:11:44 -04:00 committed by GitHub
parent f1472ffcac
commit 8a7f67d4d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

3
.gitignore vendored
View file

@ -53,8 +53,9 @@ datatracker.sublime-workspace
/share
/static
/testresult
/.testresult
/tmp
/tmp-nomcom-public-keys-dir
/tmp-*
/trunk27
/trunk36
/trunk37

View file

@ -136,7 +136,7 @@ USER vscode:vscode
# Install current datatracker python dependencies
COPY requirements.txt /tmp/pip-tmp/
RUN pip3 --disable-pip-version-check --no-cache-dir install --user -r /tmp/pip-tmp/requirements.txt
RUN pip3 --disable-pip-version-check --no-cache-dir install --user --no-warn-script-location -r /tmp/pip-tmp/requirements.txt
RUN sudo rm -rf /tmp/pip-tmp
# ENTRYPOINT [ "/docker-init.sh" ]

View file

@ -422,8 +422,7 @@ def save_test_results(failures, test_labels):
# Record the test result in a file, in order to be able to check the
# results and avoid re-running tests if we've alread run them with OK
# result after the latest code changes:
topdir = os.path.dirname(os.path.dirname(settings.BASE_DIR))
tfile = io.open(os.path.join(topdir,".testresult"), "a", encoding='utf-8')
tfile = io.open(".testresult", "a", encoding='utf-8')
timestr = time.strftime("%Y-%m-%d %H:%M:%S")
if failures:
tfile.write("%s FAILED (failures=%s)\n" % (timestr, failures))
@ -929,7 +928,7 @@ class IetfTestRunner(DiscoverRunner):
testcase = TestCase()
cwd = pathlib.Path.cwd()
tmpdir = tempfile.TemporaryDirectory(prefix="html-validate-")
Path(tmpdir.name).chmod(0o655)
Path(tmpdir.name).chmod(0o777)
for (name, content, fingerprint) in self.batches[kind]:
path = pathlib.Path(tmpdir.name).joinpath(
hex(fingerprint)[2:],