Skip to content

Commit

Permalink
fix: better main test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremad committed Nov 22, 2023
1 parent 5d462f3 commit f745427
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion py_loop/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ArgsList = Optional[List[str]]


def main(args: ArgsList = None) -> None:
def main(args: ArgsList = None) -> Looper:
parser = argparse.ArgumentParser()
parser.add_argument(
"cmd",
Expand Down Expand Up @@ -59,3 +59,4 @@ def main(args: ArgsList = None) -> None:
total_time=args_ns.total_time,
)
looper.loop()
return looper
6 changes: 3 additions & 3 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ def test_no_cmd() -> None:
assert e.value.code == 1


def test_cmd() -> None:
looper_main.main(["ls", "--max-tries", "1"])
looper_main.main(["--max-tries", "1", "ls"])
def test_parsing() -> None:
looper = looper_main.main(["--max-tries", "7", "ls"])
assert looper.max_tries == 7

0 comments on commit f745427

Please sign in to comment.