summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Reddy <tyler.je.reddy@gmail.com>2018-10-02 12:12:00 -0700
committerTyler Reddy <tyler.je.reddy@gmail.com>2018-10-02 12:12:00 -0700
commit368f7ab3f50a826902a64080a15a17e86fa95e4c (patch)
treeecbe875da340a660b9b26264e54d52e3c01a02fe
parent7511d0b2b0ce924be152913c0c87e60e4065f7be (diff)
downloadnumpy-368f7ab3f50a826902a64080a15a17e86fa95e4c.tar.gz
BUG: test_path() now uses Path.resolve()
* test_path() in test_memmap.py no longer uses os.path.realpath() because of failure to resolve symlinks on Windows--a CPython bug that is still open * this was discovered in testing on the Azure CI platform, where a symlink was resolved by memmap in NumPy using Path.resolve(), while the unit test verifying this behavior used os.path.realpath()
-rw-r--r--numpy/core/tests/test_memmap.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/core/tests/test_memmap.py b/numpy/core/tests/test_memmap.py
index 59ca28324..990d0ae26 100644
--- a/numpy/core/tests/test_memmap.py
+++ b/numpy/core/tests/test_memmap.py
@@ -81,7 +81,10 @@ class TestMemmap(object):
tmpname = mktemp('', 'mmap', dir=self.tempdir)
fp = memmap(Path(tmpname), dtype=self.dtype, mode='w+',
shape=self.shape)
- abspath = os.path.realpath(os.path.abspath(tmpname))
+ # os.path.realpath does not resolve symlinks on Windows
+ # see: https://bugs.python.org/issue9949
+ # use Path.resolve, just as memmap class does internally
+ abspath = str(Path(tmpname).resolve())
fp[:] = self.data[:]
assert_equal(abspath, str(fp.filename.resolve()))
b = fp[:1]