mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
test_dirstack::test_cdpath_expansion leaving stray dirs
This commit is contained in:
parent
2e5234da02
commit
e2174dc34d
2 changed files with 21 additions and 7 deletions
13
news/test-dirstack.rst
Normal file
13
news/test-dirstack.rst
Normal file
|
@ -0,0 +1,13 @@
|
|||
**Added:** None
|
||||
|
||||
**Changed:** None
|
||||
|
||||
**Deprecated:** None
|
||||
|
||||
**Removed:** None
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* test_dirstack test_cdpath_expansion leaving stray testing dirs
|
||||
|
||||
**Security:** None
|
|
@ -59,13 +59,14 @@ def test_cdpath_expansion(xonsh_builtins):
|
|||
os.path.expanduser("~/xonsh-test-cdpath-home")
|
||||
)
|
||||
try:
|
||||
for _ in test_dirs:
|
||||
if not os.path.exists(_):
|
||||
os.mkdir(_)
|
||||
assert os.path.exists(dirstack._try_cdpath(_)), "dirstack._try_cdpath: could not resolve {0}".format(_)
|
||||
except Exception as e:
|
||||
tuple(os.rmdir(_) for _ in test_dirs if os.path.exists(_))
|
||||
raise e
|
||||
for d in test_dirs:
|
||||
if not os.path.exists(d):
|
||||
os.mkdir(d)
|
||||
assert os.path.exists(dirstack._try_cdpath(d)), "dirstack._try_cdpath: could not resolve {0}".format(d)
|
||||
finally:
|
||||
for d in test_dirs:
|
||||
if os.path.exists(d):
|
||||
os.rmdir(d)
|
||||
|
||||
|
||||
def test_cdpath_events(xonsh_builtins, tmpdir):
|
||||
|
|
Loading…
Add table
Reference in a new issue