nti.testing 4.4.0__tar.gz → 4.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nti_testing-4.4.0 → nti_testing-4.5.1}/CHANGES.rst +13 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/PKG-INFO +15 -1
- {nti_testing-4.4.0 → nti_testing-4.5.1}/docs/conf.py +4 -4
- {nti_testing-4.4.0 → nti_testing-4.5.1}/setup.py +2 -1
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/base.py +20 -7
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/tests/test_base.py +14 -7
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti.testing.egg-info/PKG-INFO +15 -1
- {nti_testing-4.4.0 → nti_testing-4.5.1}/tox.ini +2 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/.coveragerc +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/.isort.cfg +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/.nti_cover_package +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/.pylintrc +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/.readthedocs.yml +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/.travis.yml +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/COPYRIGHT.txt +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/INSTALL +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/LICENSE +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/MANIFEST.in +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/README.rst +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/TODO +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/doc-requirements.txt +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/docs/_static/custom.css +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/docs/api.rst +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/docs/base.rst +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/docs/changelog.rst +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/docs/index.rst +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/docs/layers.rst +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/docs/matchers.rst +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/docs/time.rst +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/docs/zodb.rst +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/pyproject.toml +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/setup.cfg +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/__init__.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/__init__.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/layers/__init__.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/layers/cleanup.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/layers/postgres.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/layers/tests/__init__.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/layers/tests/test_postgres.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/layers/zope.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/matchers.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/mock.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/tests/__init__.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/tests/test_component_cleanup_broken.txt +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/tests/test_layers.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/tests/test_main.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/tests/test_matchers.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/tests/test_time.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/tests/test_zodb.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/time.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/zodb.py +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti.testing.egg-info/SOURCES.txt +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti.testing.egg-info/dependency_links.txt +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti.testing.egg-info/requires.txt +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti.testing.egg-info/top_level.txt +0 -0
- {nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti.testing.egg-info/zip-safe +0 -0
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
Changes
|
|
3
3
|
=========
|
|
4
4
|
|
|
5
|
+
4.5.1 (2026-07-15)
|
|
6
|
+
==================
|
|
7
|
+
|
|
8
|
+
- Make ``patch_object`` really return the mock object, as documented.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
4.5.0 (2026-07-07)
|
|
12
|
+
==================
|
|
13
|
+
|
|
14
|
+
- Add ``patch_object`` to the test bases.
|
|
15
|
+
- Add support for Python 3.15.
|
|
16
|
+
|
|
17
|
+
|
|
5
18
|
4.4.0 (2025-11-14)
|
|
6
19
|
==================
|
|
7
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nti.testing
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.5.1
|
|
4
4
|
Summary: Support for testing code
|
|
5
5
|
Home-page: https://github.com/OpenNTI/nti.testing
|
|
6
6
|
Author: Jason Madden
|
|
@@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
22
23
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
23
24
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
24
25
|
Classifier: Topic :: Software Development :: Testing
|
|
@@ -322,6 +323,19 @@ ZODB in `nti.testing.zodb`. See the API documentation for details.
|
|
|
322
323
|
Changes
|
|
323
324
|
=========
|
|
324
325
|
|
|
326
|
+
4.5.1 (2026-07-15)
|
|
327
|
+
==================
|
|
328
|
+
|
|
329
|
+
- Make ``patch_object`` really return the mock object, as documented.
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
4.5.0 (2026-07-07)
|
|
333
|
+
==================
|
|
334
|
+
|
|
335
|
+
- Add ``patch_object`` to the test bases.
|
|
336
|
+
- Add support for Python 3.15.
|
|
337
|
+
|
|
338
|
+
|
|
325
339
|
4.4.0 (2025-11-14)
|
|
326
340
|
==================
|
|
327
341
|
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
# sys.path.insert(0, os.path.abspath('.'))
|
|
22
22
|
import os
|
|
23
23
|
import sys
|
|
24
|
-
import
|
|
24
|
+
from importlib.metadata import version as pkg_version
|
|
25
25
|
sys.path.append(os.path.abspath('../src'))
|
|
26
|
-
|
|
26
|
+
nti_ver = pkg_version('nti.testing')
|
|
27
27
|
|
|
28
28
|
# -- General configuration ------------------------------------------------
|
|
29
29
|
|
|
@@ -65,9 +65,9 @@ author = u'NextThought'
|
|
|
65
65
|
# built documents.
|
|
66
66
|
#
|
|
67
67
|
# The short X.Y version.
|
|
68
|
-
version = '%s.%s' % tuple(map(int,
|
|
68
|
+
version = '%s.%s' % tuple(map(int, nti_ver.split('.')[:2]))
|
|
69
69
|
# The full version, including alpha/beta/rc tags.
|
|
70
|
-
release =
|
|
70
|
+
release = nti_ver
|
|
71
71
|
|
|
72
72
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
73
73
|
# for a list of supported languages.
|
|
@@ -6,7 +6,7 @@ from setuptools import setup
|
|
|
6
6
|
from setuptools import find_namespace_packages
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
version = '4.
|
|
9
|
+
version = '4.5.1'
|
|
10
10
|
|
|
11
11
|
entry_points = {
|
|
12
12
|
}
|
|
@@ -47,6 +47,7 @@ setup(
|
|
|
47
47
|
'Programming Language :: Python :: 3.12',
|
|
48
48
|
'Programming Language :: Python :: 3.13',
|
|
49
49
|
'Programming Language :: Python :: 3.14',
|
|
50
|
+
'Programming Language :: Python :: 3.15',
|
|
50
51
|
'Programming Language :: Python :: Implementation :: CPython',
|
|
51
52
|
'Programming Language :: Python :: Implementation :: PyPy',
|
|
52
53
|
'Topic :: Software Development :: Testing',
|
|
@@ -7,32 +7,29 @@ In some cases, you may be better off using :mod:`zope.component.testlayer`.
|
|
|
7
7
|
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
-
from __future__ import absolute_import
|
|
11
|
-
from __future__ import division
|
|
12
|
-
from __future__ import print_function
|
|
13
|
-
|
|
14
10
|
# stdlib imports
|
|
15
11
|
import gc
|
|
12
|
+
import logging
|
|
16
13
|
import os
|
|
17
14
|
import platform
|
|
18
15
|
import sys
|
|
19
16
|
import unittest
|
|
20
17
|
from unittest.mock import patch as Patch
|
|
21
18
|
|
|
19
|
+
import zope.testing.cleanup
|
|
22
20
|
from zope import component
|
|
23
21
|
from zope.component import eventtesting
|
|
24
22
|
from zope.component.hooks import setHooks
|
|
25
23
|
from zope.configuration import config
|
|
26
24
|
from zope.configuration import xmlconfig
|
|
27
25
|
from zope.dottedname import resolve as dottedname
|
|
28
|
-
import zope.testing.cleanup
|
|
29
26
|
|
|
30
27
|
from hamcrest import assert_that
|
|
31
28
|
from hamcrest import is_
|
|
32
29
|
|
|
33
30
|
from . import transactionCleanUp
|
|
34
31
|
|
|
35
|
-
logger =
|
|
32
|
+
logger = logging.getLogger(__name__)
|
|
36
33
|
|
|
37
34
|
|
|
38
35
|
_marker = object()
|
|
@@ -94,7 +91,7 @@ class AbstractConfiguringObject(object):
|
|
|
94
91
|
package=obj.get_configuration_package())
|
|
95
92
|
|
|
96
93
|
@staticmethod
|
|
97
|
-
def _do_configure_packages(obj, # pylint:disable=too-many-positional-arguments
|
|
94
|
+
def _do_configure_packages(obj, # pylint: disable=too-many-positional-arguments
|
|
98
95
|
set_up_packages=(),
|
|
99
96
|
features=(),
|
|
100
97
|
context=_marker,
|
|
@@ -166,6 +163,22 @@ class PatchingMixin:
|
|
|
166
163
|
"""
|
|
167
164
|
return self._install_patch(Patch(*args, **kwargs))
|
|
168
165
|
|
|
166
|
+
def patch_object(self, target, attribute, *args, **kwargs):
|
|
167
|
+
"""
|
|
168
|
+
API for subclasses. All args are passed through to :obj:`unittest.mock.patch.object`
|
|
169
|
+
which is then started and registered for cleanup.
|
|
170
|
+
|
|
171
|
+
This is intended to be used in ``setUp`` or individual test methods
|
|
172
|
+
when what you might need to patch is dynamic.
|
|
173
|
+
|
|
174
|
+
Returns the result of ``patch.start()``, i.e., a mock object.
|
|
175
|
+
|
|
176
|
+
.. versionadded:: 4.5.0
|
|
177
|
+
.. versionchanged:: 4.5.1
|
|
178
|
+
Actually return the mock object.
|
|
179
|
+
"""
|
|
180
|
+
return self._install_patch(Patch.object(target, attribute, *args, **kwargs))
|
|
181
|
+
|
|
169
182
|
def _install_patch(self, patcher):
|
|
170
183
|
"""
|
|
171
184
|
Starts the *patcher*, and registers a test tear down cleanup
|
|
@@ -3,13 +3,8 @@
|
|
|
3
3
|
"""
|
|
4
4
|
Tests for base.py.
|
|
5
5
|
|
|
6
|
-
.. $Id$
|
|
7
6
|
"""
|
|
8
7
|
|
|
9
|
-
from __future__ import absolute_import
|
|
10
|
-
from __future__ import division
|
|
11
|
-
from __future__ import print_function
|
|
12
|
-
|
|
13
8
|
# stdlib imports
|
|
14
9
|
import unittest
|
|
15
10
|
|
|
@@ -21,8 +16,6 @@ from hamcrest import is_
|
|
|
21
16
|
|
|
22
17
|
__docformat__ = "restructuredtext en"
|
|
23
18
|
|
|
24
|
-
logger = __import__('logging').getLogger(__name__)
|
|
25
|
-
|
|
26
19
|
#disable: accessing protected members, too many methods
|
|
27
20
|
#pylint: disable=W0212,R0904
|
|
28
21
|
|
|
@@ -164,3 +157,17 @@ class TestBase(unittest.TestCase):
|
|
|
164
157
|
X().tearDown()
|
|
165
158
|
Y().setUp()
|
|
166
159
|
Y().tearDown()
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class TestPatchingMixin(base.PatchingMixin, unittest.TestCase):
|
|
163
|
+
|
|
164
|
+
def test_patch_object(self):
|
|
165
|
+
class ToPatch:
|
|
166
|
+
def meth(self):
|
|
167
|
+
return -1
|
|
168
|
+
|
|
169
|
+
to_patch = ToPatch()
|
|
170
|
+
patch_result = self.patch_object(to_patch, 'meth', return_value=42)
|
|
171
|
+
|
|
172
|
+
self.assertEqual(to_patch.meth(), 42)
|
|
173
|
+
self.assertIsNotNone(patch_result)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nti.testing
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.5.1
|
|
4
4
|
Summary: Support for testing code
|
|
5
5
|
Home-page: https://github.com/OpenNTI/nti.testing
|
|
6
6
|
Author: Jason Madden
|
|
@@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
22
23
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
23
24
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
24
25
|
Classifier: Topic :: Software Development :: Testing
|
|
@@ -322,6 +323,19 @@ ZODB in `nti.testing.zodb`. See the API documentation for details.
|
|
|
322
323
|
Changes
|
|
323
324
|
=========
|
|
324
325
|
|
|
326
|
+
4.5.1 (2026-07-15)
|
|
327
|
+
==================
|
|
328
|
+
|
|
329
|
+
- Make ``patch_object`` really return the mock object, as documented.
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
4.5.0 (2026-07-07)
|
|
333
|
+
==================
|
|
334
|
+
|
|
335
|
+
- Add ``patch_object`` to the test bases.
|
|
336
|
+
- Add support for Python 3.15.
|
|
337
|
+
|
|
338
|
+
|
|
325
339
|
4.4.0 (2025-11-14)
|
|
326
340
|
==================
|
|
327
341
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nti_testing-4.4.0 → nti_testing-4.5.1}/src/nti/testing/tests/test_component_cleanup_broken.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|