summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-03-11 23:08:11 +0200
committerBerker Peksag <berker.peksag@gmail.com>2016-03-11 23:08:11 +0200
commitd0e9b6919f5764c20dfeae720b28e80652ddb00e (patch)
treecbf8f6e2cc4bd51b13f72ae33f334fae6d09c7fc
parenta55553d7e3f86d5f2475720823ec2ac7f944e3e6 (diff)
parent04d4229719055c9536da6d4b58033981ef86d0d2 (diff)
downloadcpython-git-d0e9b6919f5764c20dfeae720b28e80652ddb00e.tar.gz
Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise
NotImplementedError instead of ImportError.
-rw-r--r--Lib/pathlib.py6
-rw-r--r--Lib/test/test_pathlib.py9
-rw-r--r--Misc/NEWS3
3 files changed, 18 insertions, 0 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 5169ff5e63..ed31ddb8dd 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -1425,3 +1425,9 @@ class PosixPath(Path, PurePosixPath):
class WindowsPath(Path, PureWindowsPath):
__slots__ = ()
+
+ def owner(self):
+ raise NotImplementedError("Path.owner() is unsupported on this system")
+
+ def group(self):
+ raise NotImplementedError("Path.group() is unsupported on this system")
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index 9a98d46c4e..451e41f5ff 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -1156,6 +1156,15 @@ class PureWindowsPathTest(_BasePurePathTest, unittest.TestCase):
# UNC paths are never reserved
self.assertIs(False, P('//my/share/nul/con/aux').is_reserved())
+ def test_owner(self):
+ P = self.cls
+ with self.assertRaises(NotImplementedError):
+ P('c:/').owner()
+
+ def test_group(self):
+ P = self.cls
+ with self.assertRaises(NotImplementedError):
+ P('c:/').group()
class PurePathTest(_BasePurePathTest, unittest.TestCase):
cls = pathlib.PurePath
diff --git a/Misc/NEWS b/Misc/NEWS
index 542af60005..45d8f2e2b6 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -201,6 +201,9 @@ Core and Builtins
Library
-------
+- Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise
+ NotImplementedError instead of ImportError.
+
- Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets.
- Issue #21042: Make ctypes.util.find_library() return the full path on