mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 01:18:26 +00:00
tests - fix missing copytree import and self parameter
This commit is contained in:
parent
cc760a646b
commit
ab57be6570
2 changed files with 6 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue