parent
38ed6e4c59
commit
fe9b8434dd
@ -1 +1 @@
|
|||||||
SOURCES/mock-2.0.0.tar.gz
|
SOURCES/mock-4.0.3.tar.gz
|
||||||
|
@ -1 +1 @@
|
|||||||
397ed52eb2d8d4b326bc3fa6b38adda5f0b090d3 SOURCES/mock-2.0.0.tar.gz
|
177c1059c58d80ad33ef0b7f480ef72d287acfb2 SOURCES/mock-4.0.3.tar.gz
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
From 894204aba025609a91ad219767b88caa65d81259 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Lumir Balhar <lbalhar@redhat.com>
|
|
||||||
Date: Wed, 20 Jun 2018 12:47:42 +0200
|
|
||||||
Subject: [PATCH] Remove pbr dependency
|
|
||||||
|
|
||||||
---
|
|
||||||
mock/mock.py | 6 ++----
|
|
||||||
requirements.txt | 4 ----
|
|
||||||
setup.cfg | 3 +++
|
|
||||||
setup.py | 3 +--
|
|
||||||
4 files changed, 6 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/mock/mock.py b/mock/mock.py
|
|
||||||
index c674a85..afa1105 100644
|
|
||||||
--- a/mock/mock.py
|
|
||||||
+++ b/mock/mock.py
|
|
||||||
@@ -66,11 +66,9 @@ from types import ModuleType
|
|
||||||
|
|
||||||
import six
|
|
||||||
from six import wraps
|
|
||||||
-from pbr.version import VersionInfo
|
|
||||||
|
|
||||||
-_v = VersionInfo('mock').semantic_version()
|
|
||||||
-__version__ = _v.release_string()
|
|
||||||
-version_info = _v.version_tuple()
|
|
||||||
+__version__ = 'VERSIONPLACEHOLDER'
|
|
||||||
+version_info = tuple(map(int, __version__.split('.'))) + ('final', 0)
|
|
||||||
|
|
||||||
import mock
|
|
||||||
|
|
||||||
diff --git a/requirements.txt b/requirements.txt
|
|
||||||
index 31bbe5d..bca9f9b 100644
|
|
||||||
--- a/requirements.txt
|
|
||||||
+++ b/requirements.txt
|
|
||||||
@@ -1,6 +1,2 @@
|
|
||||||
funcsigs>=1;python_version<"3.3"
|
|
||||||
-# For runtime needs this is correct. For setup_requires needs, 1.2.0 is needed
|
|
||||||
-# but setuptools can't cope with conflicts in setup_requires, so thats
|
|
||||||
-# unversioned.
|
|
||||||
-pbr>=0.11
|
|
||||||
six>=1.9
|
|
||||||
diff --git a/setup.cfg b/setup.cfg
|
|
||||||
index f5e0a02..3f7f263 100644
|
|
||||||
--- a/setup.cfg
|
|
||||||
+++ b/setup.cfg
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
[metadata]
|
|
||||||
name = mock
|
|
||||||
+version = VERSIONPLACEHOLDER
|
|
||||||
summary = Rolling backport of unittest.mock for all Pythons
|
|
||||||
home-page = https://github.com/testing-cabal/mock
|
|
||||||
description-file = README.rst
|
|
||||||
@@ -49,3 +50,5 @@ tag_build =
|
|
||||||
tag_date = 0
|
|
||||||
tag_svn_revision = 0
|
|
||||||
|
|
||||||
+[options]
|
|
||||||
+packages = mock
|
|
||||||
diff --git a/setup.py b/setup.py
|
|
||||||
index 5f727ae..b80f541 100755
|
|
||||||
--- a/setup.py
|
|
||||||
+++ b/setup.py
|
|
||||||
@@ -2,5 +2,4 @@
|
|
||||||
import setuptools
|
|
||||||
|
|
||||||
setuptools.setup(
|
|
||||||
- setup_requires=['pbr>=1.3', 'setuptools>=17.1'],
|
|
||||||
- pbr=True)
|
|
||||||
+ setup_requires=['setuptools>=17.1'])
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
|||||||
|
From f3e3d82aab0ede7e25273806dc0505574d85eae2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chris Withers <chris@simplistix.co.uk>
|
||||||
|
Date: Thu, 15 Apr 2021 08:27:25 +0100
|
||||||
|
Subject: [PATCH] fix tests that should test mock but were testing
|
||||||
|
unittest.mock
|
||||||
|
|
||||||
|
---
|
||||||
|
mock/tests/testmock.py | 15 ++++++++-------
|
||||||
|
1 file changed, 8 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mock/tests/testmock.py b/mock/tests/testmock.py
|
||||||
|
index 5702b6d..1a70909 100644
|
||||||
|
--- a/mock/tests/testmock.py
|
||||||
|
+++ b/mock/tests/testmock.py
|
||||||
|
@@ -13,6 +13,7 @@
|
||||||
|
create_autospec, mock
|
||||||
|
)
|
||||||
|
from mock.mock import _Call, _CallList
|
||||||
|
+import mock.mock as mock_module
|
||||||
|
|
||||||
|
|
||||||
|
class Iter(object):
|
||||||
|
@@ -47,7 +48,7 @@ def test_all(self):
|
||||||
|
# if __all__ is badly defined then import * will raise an error
|
||||||
|
# We have to exec it because you can't import * inside a method
|
||||||
|
# in Python 3
|
||||||
|
- exec("from unittest.mock import *")
|
||||||
|
+ exec("from mock.mock import *")
|
||||||
|
|
||||||
|
|
||||||
|
def test_constructor(self):
|
||||||
|
@@ -2137,16 +2138,16 @@ def test_isinstance_under_settrace(self):
|
||||||
|
# test_patch_dict_test_prefix and test_patch_test_prefix not restoring
|
||||||
|
# causes the objects patched to go out of sync
|
||||||
|
|
||||||
|
- old_patch = unittest.mock.patch
|
||||||
|
+ old_patch = mock_module.patch
|
||||||
|
|
||||||
|
# Directly using __setattr__ on unittest.mock causes current imported
|
||||||
|
# reference to be updated. Use a lambda so that during cleanup the
|
||||||
|
# re-imported new reference is updated.
|
||||||
|
- self.addCleanup(lambda patch: setattr(unittest.mock, 'patch', patch),
|
||||||
|
+ self.addCleanup(lambda patch: setattr(mock_module, 'patch', patch),
|
||||||
|
old_patch)
|
||||||
|
|
||||||
|
with patch.dict('sys.modules'):
|
||||||
|
- del sys.modules['unittest.mock']
|
||||||
|
+ del sys.modules['mock']
|
||||||
|
|
||||||
|
# This trace will stop coverage being measured ;-)
|
||||||
|
def trace(frame, event, arg): # pragma: no cover
|
||||||
|
@@ -2155,7 +2156,7 @@ def trace(frame, event, arg): # pragma: no cover
|
||||||
|
self.addCleanup(sys.settrace, sys.gettrace())
|
||||||
|
sys.settrace(trace)
|
||||||
|
|
||||||
|
- from unittest.mock import (
|
||||||
|
+ from mock.mock import (
|
||||||
|
Mock, MagicMock, NonCallableMock, NonCallableMagicMock
|
||||||
|
)
|
||||||
|
|
||||||
|
@@ -2170,10 +2171,10 @@ def trace(frame, event, arg): # pragma: no cover
|
||||||
|
def test_bool_not_called_when_passing_spec_arg(self):
|
||||||
|
class Something:
|
||||||
|
def __init__(self):
|
||||||
|
- self.obj_with_bool_func = unittest.mock.MagicMock()
|
||||||
|
+ self.obj_with_bool_func = mock_module.MagicMock()
|
||||||
|
|
||||||
|
obj = Something()
|
||||||
|
- with unittest.mock.patch.object(obj, 'obj_with_bool_func', autospec=True): pass
|
||||||
|
+ with mock_module.patch.object(obj, 'obj_with_bool_func', autospec=True): pass
|
||||||
|
|
||||||
|
self.assertEqual(obj.obj_with_bool_func.__bool__.call_count, 0)
|
||||||
|
|
Loading…
Reference in new issue