diff --git a/tests/test_helptext.py b/tests/test_helptext.py index b8aa3e47..c229a3d3 100644 --- a/tests/test_helptext.py +++ b/tests/test_helptext.py @@ -1,5 +1,6 @@ import dataclasses import enum +import os import pathlib from collections.abc import Callable from typing import Any, Dict, Generic, List, Optional, Tuple, TypeVar, Union, cast @@ -562,3 +563,11 @@ def main2(x: Callable = nn.ReLU): assert "--x {fixed}" in helptext assert "(fixed to:" in helptext assert "torch" in helptext + + +def test_pathlike() -> None: + def main(x: os.PathLike) -> None: + pass + + helptext = get_helptext(main) + assert "--x PATH " in helptext diff --git a/tests/test_tyro.py b/tests/test_tyro.py index 1aafac0e..c7f8e536 100644 --- a/tests/test_tyro.py +++ b/tests/test_tyro.py @@ -2,6 +2,7 @@ import copy import dataclasses import enum +import os import pathlib from typing import ( Any, @@ -551,7 +552,7 @@ def main() -> argparse.ArgumentParser: def test_pathlike(): - def main(x: os.PathLike, /) -> os.PathLike: + def main(x: os.PathLike) -> os.PathLike: return x - assert tyro.cli(main, args=["/dev/null"]) == pathlib.Path("/dev/null") + assert tyro.cli(main, args=["--x", "/dev/null"]) == pathlib.Path("/dev/null")