From c631124e483b19b78bd358f02d640bbd9b44473d Mon Sep 17 00:00:00 2001 From: petschki Date: Thu, 28 Nov 2024 22:48:09 -0300 Subject: [PATCH] [fc] Repository: collective.monkeypatcher Branch: refs/heads/master Date: 2024-11-27T15:11:02-03:00 Author: Peter Mathis (petschki) Commit: https://github.com/plone/collective.monkeypatcher/commit/8c5a3ddc436f6a0c10e62564ca3788d9cdf373f9 remove deprecated unittest.makeSuite Files changed: M src/collective/monkeypatcher/tests/test_monkeypatcher.py Repository: collective.monkeypatcher Branch: refs/heads/master Date: 2024-11-27T15:12:13-03:00 Author: Peter Mathis (petschki) Commit: https://github.com/plone/collective.monkeypatcher/commit/dd64846474ae56e32d1be52d2e24c228a18af032 changenote Files changed: A news/14.bugfix Repository: collective.monkeypatcher Branch: refs/heads/master Date: 2024-11-28T22:48:09-03:00 Author: Peter Mathis (petschki) Commit: https://github.com/plone/collective.monkeypatcher/commit/b68bd2bca30c5d7b4b9d192c40fd06c0d64a431d Merge pull request #14 from plone/py-3.13-unittest Fix removed `unittest.makeSuite` in py 3.13 Files changed: A news/14.bugfix M src/collective/monkeypatcher/tests/test_monkeypatcher.py --- last_commit.txt | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/last_commit.txt b/last_commit.txt index cc8c3db2e9..abec4d24a0 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,48 +1,48 @@ -Repository: plone.testing +Repository: collective.monkeypatcher Branch: refs/heads/master -Date: 2024-11-27T15:53:25-03:00 +Date: 2024-11-27T15:11:02-03:00 Author: Peter Mathis (petschki) -Commit: https://github.com/plone/plone.testing/commit/dc7bcbb295e338d2e2f2fb7a4999a159dd944c1a +Commit: https://github.com/plone/collective.monkeypatcher/commit/8c5a3ddc436f6a0c10e62564ca3788d9cdf373f9 -Fix README for removed `unittest.makeSuite` +remove deprecated unittest.makeSuite Files changed: -M src/plone/testing/README.rst +M src/collective/monkeypatcher/tests/test_monkeypatcher.py -b"diff --git a/src/plone/testing/README.rst b/src/plone/testing/README.rst\nindex 69fc422..88d48e3 100644\n--- a/src/plone/testing/README.rst\n+++ b/src/plone/testing/README.rst\n@@ -840,14 +840,14 @@ To add the doctests from a particular module to a test suite, you need to use th\n >>> def test_suite():\n ... suite = unittest.TestSuite()\n ... suite.addTests([\n- ... unittest.makeSuite(TestFasterThanLightTravel), # our previous test\n+ ... unittest.defaultTestLoader.loadTestsFromTestCase(TestFasterThanLightTravel), # our previous test\n ... doctest.DocTestSuite('spaceship.utils'),\n ... ])\n ... return suite\n \n Here, we have given the name of the module to check as a string dotted name.\n It is also possible to import a module and pass it as an object.\n-The code above passes a list to ``addTests()``, making it easy to add several sets of tests to the suite: the list can be constructed from calls to ``DocTestSuite()``, ``DocFileSuite()`` (shown below) and ``makeSuite()`` (shown above).\n+The code above passes a list to ``addTests()``, making it easy to add several sets of tests to the suite: the list can be constructed from calls to ``DocTestSuite()``, ``DocFileSuite()`` (shown below) and ``unittest.defaultTestLoader.loadTestsFromTestCase()`` (shown above).\n \n Remember that if you add a ``test_suite()`` function to a module that also has ``TestCase``-derived python tests, those tests will no longer be automatically picked up by ``zope.testing``, so you need to add them to the test suite explicitly.\n \n@@ -901,7 +901,7 @@ For example, if we had a file called ``spaceship.txt`` with doctests, we could a\n >>> def test_suite():\n ... suite = unittest.TestSuite()\n ... suite.addTests([\n- ... unittest.makeSuite(TestFasterThanLightTravel),\n+ ... unittest.defaultTestLoader.loadTestsFromTestCase(TestFasterThanLightTravel),\n ... doctest.DocTestSuite('spaceship.utils'),\n ... doctest.DocFileSuite('spaceship.txt'),\n ... ])\n@@ -920,7 +920,7 @@ It is possible to pass several tests to the suite, e.g.::\n >>> def test_suite():\n ... suite = unittest.TestSuite()\n ... suite.addTests([\n- ... unittest.makeSuite(TestFasterThanLightTravel),\n+ ... unittest.defaultTestLoader.loadTestsFromTestCase(TestFasterThanLightTravel),\n ... doctest.DocTestSuite('spaceship.utils'),\n ... doctest.DocFileSuite('spaceship.txt', 'warpdrive.txt',),\n ... ])\n" +b'diff --git a/src/collective/monkeypatcher/tests/test_monkeypatcher.py b/src/collective/monkeypatcher/tests/test_monkeypatcher.py\nindex fec3dff..30a7c8f 100644\n--- a/src/collective/monkeypatcher/tests/test_monkeypatcher.py\n+++ b/src/collective/monkeypatcher/tests/test_monkeypatcher.py\n@@ -67,7 +67,8 @@ def test_monkeyPatchEvent(self):\n \n \n def test_suite():\n- from unittest import TestSuite, makeSuite\n- suite = TestSuite()\n- suite.addTest(makeSuite(TestMonkeyPatcher))\n- return suite\n+ import unittest\n+\n+ return unittest.TestSuite((\n+ unittest.defaultTestLoader.loadTestsFromTestCase(TestMonkeyPatcher),\n+ ))\n' -Repository: plone.testing +Repository: collective.monkeypatcher Branch: refs/heads/master -Date: 2024-11-27T15:54:45-03:00 +Date: 2024-11-27T15:12:13-03:00 Author: Peter Mathis (petschki) -Commit: https://github.com/plone/plone.testing/commit/d6b3fb6730a3bbaca9f5d6d8993376de612b19d0 +Commit: https://github.com/plone/collective.monkeypatcher/commit/dd64846474ae56e32d1be52d2e24c228a18af032 changenote Files changed: -A news/100.bugfix +A news/14.bugfix -b'diff --git a/news/100.bugfix b/news/100.bugfix\nnew file mode 100644\nindex 0000000..cdd0f35\n--- /dev/null\n+++ b/news/100.bugfix\n@@ -0,0 +1,2 @@\n+Fix README for removed `unittest.makeSuite` in python 3.13.\n+[petschki]\n' +b'diff --git a/news/14.bugfix b/news/14.bugfix\nnew file mode 100644\nindex 0000000..41e6fd2\n--- /dev/null\n+++ b/news/14.bugfix\n@@ -0,0 +1,2 @@\n+Fix removed `unittest.makeSuite` in python 3.13.\n+[petschki]\n' -Repository: plone.testing +Repository: collective.monkeypatcher Branch: refs/heads/master -Date: 2024-11-28T11:40:54-03:00 -Author: David Glick (davisagli) -Commit: https://github.com/plone/plone.testing/commit/a7898ce728ad683f8758bebda5739d1d51a6fdcd +Date: 2024-11-28T22:48:09-03:00 +Author: Peter Mathis (petschki) +Commit: https://github.com/plone/collective.monkeypatcher/commit/b68bd2bca30c5d7b4b9d192c40fd06c0d64a431d -Merge pull request #100 from plone/unittest-py-3.13 +Merge pull request #14 from plone/py-3.13-unittest -Fix README for removed `unittest.makeSuite` +Fix removed `unittest.makeSuite` in py 3.13 Files changed: -A news/100.bugfix -M src/plone/testing/README.rst +A news/14.bugfix +M src/collective/monkeypatcher/tests/test_monkeypatcher.py -b"diff --git a/news/100.bugfix b/news/100.bugfix\nnew file mode 100644\nindex 0000000..cdd0f35\n--- /dev/null\n+++ b/news/100.bugfix\n@@ -0,0 +1,2 @@\n+Fix README for removed `unittest.makeSuite` in python 3.13.\n+[petschki]\ndiff --git a/src/plone/testing/README.rst b/src/plone/testing/README.rst\nindex 69fc422..88d48e3 100644\n--- a/src/plone/testing/README.rst\n+++ b/src/plone/testing/README.rst\n@@ -840,14 +840,14 @@ To add the doctests from a particular module to a test suite, you need to use th\n >>> def test_suite():\n ... suite = unittest.TestSuite()\n ... suite.addTests([\n- ... unittest.makeSuite(TestFasterThanLightTravel), # our previous test\n+ ... unittest.defaultTestLoader.loadTestsFromTestCase(TestFasterThanLightTravel), # our previous test\n ... doctest.DocTestSuite('spaceship.utils'),\n ... ])\n ... return suite\n \n Here, we have given the name of the module to check as a string dotted name.\n It is also possible to import a module and pass it as an object.\n-The code above passes a list to ``addTests()``, making it easy to add several sets of tests to the suite: the list can be constructed from calls to ``DocTestSuite()``, ``DocFileSuite()`` (shown below) and ``makeSuite()`` (shown above).\n+The code above passes a list to ``addTests()``, making it easy to add several sets of tests to the suite: the list can be constructed from calls to ``DocTestSuite()``, ``DocFileSuite()`` (shown below) and ``unittest.defaultTestLoader.loadTestsFromTestCase()`` (shown above).\n \n Remember that if you add a ``test_suite()`` function to a module that also has ``TestCase``-derived python tests, those tests will no longer be automatically picked up by ``zope.testing``, so you need to add them to the test suite explicitly.\n \n@@ -901,7 +901,7 @@ For example, if we had a file called ``spaceship.txt`` with doctests, we could a\n >>> def test_suite():\n ... suite = unittest.TestSuite()\n ... suite.addTests([\n- ... unittest.makeSuite(TestFasterThanLightTravel),\n+ ... unittest.defaultTestLoader.loadTestsFromTestCase(TestFasterThanLightTravel),\n ... doctest.DocTestSuite('spaceship.utils'),\n ... doctest.DocFileSuite('spaceship.txt'),\n ... ])\n@@ -920,7 +920,7 @@ It is possible to pass several tests to the suite, e.g.::\n >>> def test_suite():\n ... suite = unittest.TestSuite()\n ... suite.addTests([\n- ... unittest.makeSuite(TestFasterThanLightTravel),\n+ ... unittest.defaultTestLoader.loadTestsFromTestCase(TestFasterThanLightTravel),\n ... doctest.DocTestSuite('spaceship.utils'),\n ... doctest.DocFileSuite('spaceship.txt', 'warpdrive.txt',),\n ... ])\n" +b'diff --git a/news/14.bugfix b/news/14.bugfix\nnew file mode 100644\nindex 0000000..41e6fd2\n--- /dev/null\n+++ b/news/14.bugfix\n@@ -0,0 +1,2 @@\n+Fix removed `unittest.makeSuite` in python 3.13.\n+[petschki]\ndiff --git a/src/collective/monkeypatcher/tests/test_monkeypatcher.py b/src/collective/monkeypatcher/tests/test_monkeypatcher.py\nindex fec3dff..30a7c8f 100644\n--- a/src/collective/monkeypatcher/tests/test_monkeypatcher.py\n+++ b/src/collective/monkeypatcher/tests/test_monkeypatcher.py\n@@ -67,7 +67,8 @@ def test_monkeyPatchEvent(self):\n \n \n def test_suite():\n- from unittest import TestSuite, makeSuite\n- suite = TestSuite()\n- suite.addTest(makeSuite(TestMonkeyPatcher))\n- return suite\n+ import unittest\n+\n+ return unittest.TestSuite((\n+ unittest.defaultTestLoader.loadTestsFromTestCase(TestMonkeyPatcher),\n+ ))\n'