forked from pool/python-testfixtures
* Fix bug in support for :class:`os.PathLike` arguments to
:class:`popen.MockPopen`.
* Added missing support for :class:`os.PathLike` arguments to
:class:`popen.MockPopen`.
* Add ``order_matters`` parameter to :class:`ShouldWarn`.
* Implement new IDE and static-analysis ways of :doc:`mocking <mocking>`
including additional parameters to :meth:`~Replacer.replace` along with
the :any:`replace_on_class`, :any:`replace_in_module` and
:any:`replace_in_environ` context managers.
- Add patch path-comparsion-312.patch:
* Compare paths string-wise, due to Python 3.12 changes.
- Switch to autosetup and pyproject macros.
- Remove now unneeded Python 3.6 special-casing.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-testfixtures?expand=0&rev=51
41 lines
1.3 KiB
Diff
41 lines
1.3 KiB
Diff
From 720ff80e9cfff17e4f0af1792d866edf49a8f02b Mon Sep 17 00:00:00 2001
|
|
From: Chris Withers <chris@simplistix.co.uk>
|
|
Date: Mon, 20 Nov 2023 08:20:33 +0000
|
|
Subject: [PATCH] Path internals are unequal on Python 3.12
|
|
|
|
---
|
|
testfixtures/comparison.py | 6 ++++++
|
|
1 file changed, 6 insertions(+)
|
|
|
|
diff --git a/testfixtures/comparison.py b/testfixtures/comparison.py
|
|
index c05ab75..26bddfa 100644
|
|
--- a/testfixtures/comparison.py
|
|
+++ b/testfixtures/comparison.py
|
|
@@ -4,6 +4,7 @@
|
|
from difflib import unified_diff
|
|
from functools import partial as partial_type, reduce
|
|
from operator import __or__
|
|
+from pathlib import Path
|
|
from pprint import pformat
|
|
from typing import (
|
|
Dict, Any, Optional, Sequence, Generator, TypeVar, List, Mapping, Pattern, Union,
|
|
@@ -445,6 +446,10 @@ def compare_partial(x: partial_type, y: partial_type, context: 'CompareContext')
|
|
'attributes ', '.%s')
|
|
|
|
|
|
+def compare_path(x: Path, y: Path, context: 'CompareContext') -> Optional[str]:
|
|
+ return compare_text(str(x), str(y), context)
|
|
+
|
|
+
|
|
def _short_repr(obj) -> str:
|
|
repr_ = repr(obj)
|
|
if len(repr_) > 30:
|
|
@@ -470,6 +475,7 @@ def _short_repr(obj) -> str:
|
|
unittest_mock_call.__class__: compare_call,
|
|
BaseException: compare_exception,
|
|
partial_type: compare_partial,
|
|
+ Path: compare_path,
|
|
}
|
|
|
|
|