summaryrefslogtreecommitdiffstats
path: root/Lib/test/support/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/support/__init__.py')
-rw-r--r--Lib/test/support/__init__.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index b4269f4..2c2f888 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -2840,3 +2840,21 @@ class SaveSignals:
def with_pymalloc():
import _testcapi
return _testcapi.WITH_PYMALLOC
+
+
+class FakePath:
+ """Simple implementing of the path protocol.
+ """
+ def __init__(self, path):
+ self.path = path
+
+ def __repr__(self):
+ return f'<FakePath {self.path!r}>'
+
+ def __fspath__(self):
+ if (isinstance(self.path, BaseException) or
+ isinstance(self.path, type) and
+ issubclass(self.path, BaseException)):
+ raise self.path
+ else:
+ return self.path