Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8e428a7

Browse files
committed
On Windows Path.cwd() might be in short filename/SFN format
1 parent 4a966fb commit 8e428a7

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

IPython/extensions/tests/test_storemagic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import tempfile, os
2+
from pathlib import Path
23

34
from traitlets.config.loader import Config
45

@@ -43,7 +44,7 @@ def test_store_restore():
4344
assert ip.user_ns["foobaz"] == "80"
4445

4546
ip.magic("store -r") # restores _dh too
46-
assert os.path.realpath(tmpd) in ip.user_ns["_dh"]
47+
assert any(Path(tmpd).samefile(p) for p in ip.user_ns["_dh"])
4748

4849
os.rmdir(tmpd)
4950

IPython/utils/tests/test_tempdir.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def test_named_file_in_temporary_directory():
2222

2323
def test_temporary_working_directory():
2424
with TemporaryWorkingDirectory() as directory:
25-
directory_path = Path(directory)
25+
directory_path = Path(directory).resolve()
2626
assert directory_path.exists()
27-
assert Path.cwd() == directory_path.resolve()
27+
assert Path.cwd().resolve() == directory_path
2828
assert not directory_path.exists()
29-
assert Path.cwd() != directory_path.resolve()
29+
assert Path.cwd().resolve() != directory_path

0 commit comments

Comments
 (0)