From 39ada82ba83537cab2e641f6197c61708e7f7f2b Mon Sep 17 00:00:00 2001 From: Bob Hyman Date: Sun, 14 Aug 2016 17:31:22 -0400 Subject: [PATCH] avoid test failure in execer.py:137 if cwd not on c: drive (in windows) --- .gitignore | 1 + xonsh/commands_cache.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e276a405f..7d00536a8 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ docs/_build/ docs/envvarsbody docs/xontribsbody xonsh/dev.githash +**/__pycache__/ # temporary files from vim and emacs *~ diff --git a/xonsh/commands_cache.py b/xonsh/commands_cache.py index 2c954980e..6eb283d98 100644 --- a/xonsh/commands_cache.py +++ b/xonsh/commands_cache.py @@ -133,7 +133,10 @@ class CommandsCache(abc.Mapping): if os.path.isfile(full_name) ), None) if local_bin: - return os.path.abspath(os.path.relpath(local_bin, cwd)) + if os.path.splitdrive(cwd)[0] != os.path.splitdrive(local_bin)[0]: # if cwd not on same drive as bin + return os.path.abspath(local_bin) # avoid ValueError in relpath() + else: + return os.path.abspath(os.path.relpath(local_bin, cwd)) cached = next((cmd for cmd in possibilities if cmd in self._cmds_cache), None) if cached: