From ab57be657083d9b337c2abfe5151f37b50c6b969 Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 13 Jul 2022 17:37:34 +0200 Subject: [PATCH] tests - fix missing copytree import and self parameter --- tests/Test.py | 8 ++++---- tests/main.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Test.py b/tests/Test.py index 5f4d82535..4a2c7f254 100644 --- a/tests/Test.py +++ b/tests/Test.py @@ -3,7 +3,7 @@ from sys import stderr from time import time, sleep from requests import get from traceback import format_exc -from shutil import rmtree +from shutil import rmtree, copytree from os.path import isdir, join from os import mkdir, makedirs, walk, chmod from re import sub, MULTILINE @@ -101,19 +101,19 @@ class Test(ABC) : self._log("exception while running test of type " + test["type"] + " on URL " + test["url"] + "\n" + format_exc(), error=True) raise("unknow test type " + test["type"]) - def _replace_in_file(path, old, new) : + def _replace_in_file(self, path, old, new) : with open(path, "r") as f : content = f.read() content = sub(old, new, content, flags=MULTILINE) with open(path, "w") as f : f.write(content) - def _replace_in_files(path, old, new) : + def _replace_in_files(self, path, old, new) : for root, dirs, files in walk(path) : for name in files : self._replace_in_file(join(root, name), old, new) - def _rename(path, old, new) : + def _rename(self, path, old, new) : for root, dirs, files in walk(path) : for name in dirs + files : full_path = join(root, name) diff --git a/tests/main.py b/tests/main.py index df4d0bdd6..bf940a630 100755 --- a/tests/main.py +++ b/tests/main.py @@ -2,7 +2,7 @@ from sys import path, argv, exit from glob import glob -from os import getcwd +from os import getcwd, _exit from os.path import isfile from traceback import format_exc from json import loads @@ -41,7 +41,7 @@ for example in glob("./examples/*") : test_obj = DockerTest(tests["name"], tests["timeout"], tests["tests"]) if not test_obj.run_tests() : log("TESTS", "❌", "Tests failed for " + tests["name"]) - exit(1) + _exit(1) except : log("TESTS", "❌", "Exception while executing test for example " + example + " : " + format_exc()) exit(1)