diff --git a/pyautoenv.py b/pyautoenv.py index 8350eae..19e9c02 100755 --- a/pyautoenv.py +++ b/pyautoenv.py @@ -72,7 +72,7 @@ def parse_args(argv: List[str], stdout: TextIO) -> str: # is not too complex. We won't get a full 'bells and whistles' CLI # experience, but that's fine for our use-case. if len(argv) == 0: - return "." + return os.getcwd() if any(h in argv for h in ["-h", "--help"]): stdout.write(CLI_HELP) sys.exit(0) @@ -83,7 +83,7 @@ def parse_args(argv: List[str], stdout: TextIO) -> str: raise ValueError( # noqa: TRY003 f"exactly one argument expected, found {len(argv)}", ) - return argv[0] + return os.path.abspath(argv[0]) def discover_env(directory: str) -> Union[str, None]: diff --git a/test_pyautoenv.py b/test_pyautoenv.py index a5738fd..bfd0934 100644 --- a/test_pyautoenv.py +++ b/test_pyautoenv.py @@ -61,7 +61,7 @@ def setup_method(self): def test_directory_is_cwd_by_default(self): directory = pyautoenv.parse_args([], self.stdout) - assert os.path.samefile(directory, Path.cwd()) + assert directory == str(Path.cwd()) def test_directory_is_set(self): directory = pyautoenv.parse_args(["/some/dir"], self.stdout) @@ -167,7 +167,7 @@ def test_deactivate_and_activate_switching_to_new_venv( activator, ): stdout = StringIO() - new_venv_activate = Path("pyproj2/.venv") / activator + new_venv_activate = Path("/pyproj2/.venv") / activator fs.create_file(new_venv_activate) activate_venv(self.VENV_DIR)