Skip to content

Commit

Permalink
add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Aug 12, 2024
1 parent c720fea commit 61ce837
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/unittests/unit/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import shutil
import os.path
import subprocess
from argparse import ArgumentParser

TEST_COVERAGE = os.environ.get("XPRA_TEST_COVERAGE", "1") == "1"
COVERAGE = os.environ.get("COVERAGE", shutil.which("coverage") or shutil.which("python3-coverage"))


def getargs():
from argparse import ArgumentParser
def getargs() -> ArgumentParser:
P = ArgumentParser()
P.add_argument('--skip-fail', action='append', default=[])
P.add_argument('--skip-slow', action='append', default=[])
Expand All @@ -24,7 +24,7 @@ def getargs():
return P


def main(args):
def main(args) -> int:
if TEST_COVERAGE:
# pylint: disable=import-outside-toplevel
#only include xpra in the report,
Expand All @@ -50,11 +50,11 @@ def main(args):
sys.path.append(unittests_dir)

#now look for tests to run
def write(msg):
def write(msg) -> None:
sys.stdout.write(f"{msg}\n")
sys.stdout.flush()

def run_file(p):
def run_file(p: str) -> int:
#ie: "~/projects/Xpra/trunk/src/tests/unit/version_util_test.py"
tfile = os.path.join(unittests_dir, p)
if not (os.path.isfile(tfile) and tfile.startswith(unittests_dir) and tfile.endswith("test.py")):
Expand Down Expand Up @@ -84,7 +84,7 @@ def run_file(p):
write(f"ran {name} in {T1 - T0:.2f} seconds\n")
return v

def add_recursive(d):
def add_recursive(d: str) -> int:
paths = os.listdir(d)
ret = 0
for path in paths:
Expand Down

0 comments on commit 61ce837

Please sign in to comment.