fix tests

This commit is contained in:
ed 2022-09-18 00:16:40 +02:00
parent f85d4ce82f
commit ab36c8c9de
3 changed files with 13 additions and 6 deletions

View file

@ -20,7 +20,7 @@ import time
import traceback
from textwrap import dedent
from .__init__ import ANYWIN, CORES, PY2, VT100, WINDOWS, E, unicode
from .__init__ import ANYWIN, CORES, PY2, VT100, WINDOWS, E, EnvParams, unicode
from .__version__ import CODENAME, S_BUILD_DT, S_VERSION
from .authsrv import re_vol
from .svchub import SvcHub
@ -132,7 +132,7 @@ def warn(msg: str) -> None:
lprint("\033[1mwarning:\033[0;33m {}\033[0m\n".format(msg))
def init_E() -> None:
def init_E(E: EnvParams) -> None:
# __init__ runs 18 times when oxidized; do expensive stuff here
def get_unixdir() -> str:
@ -774,7 +774,7 @@ def main(argv: Optional[list[str]] = None) -> None:
if WINDOWS:
os.system("rem") # enables colors
init_E()
init_E(E)
if argv is None:
argv = sys.argv

View file

@ -17,8 +17,10 @@ for py in python{2,3}; do
pids+=($!)
done
python3 ../scripts/test/smoketest.py &
pids+=($!)
[ "$1" ] || {
python3 ../scripts/test/smoketest.py &
pids+=($!)
}
for pid in ${pids[@]}; do
wait $pid

View file

@ -30,8 +30,12 @@ if MACOS:
# 25% faster; until any tests do symlink stuff
from copyparty.__init__ import E
from copyparty.__main__ import init_E
from copyparty.util import Unrecv, FHC
init_E(E)
def runcmd(argv):
p = sp.Popen(argv, stdout=sp.PIPE, stderr=sp.PIPE)
@ -97,7 +101,7 @@ class Cfg(Namespace):
ex = "e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp xdev xvol ed emp force_js ihead no_acode no_athumb no_del no_logues no_mv no_readme no_robots no_scandir no_thumb no_vthumb no_zip nid nih nw"
ka.update(**{k: False for k in ex.split()})
ex = "no_rescan no_sendfile no_voldump"
ex = "no_rescan no_sendfile no_voldump plain_ip"
ka.update(**{k: True for k in ex.split()})
ex = "css_browser hist js_browser no_hash no_idx no_forget"
@ -113,6 +117,7 @@ class Cfg(Namespace):
a=a or [],
v=v or [],
c=c,
E=E,
s_wr_sz=512 * 1024,
unpost=600,
u2sort="s",