diff --git a/0001-Mock-in-Python-3.12-finds-more-errors-in-mock-syntax.patch b/0001-Mock-in-Python-3.12-finds-more-errors-in-mock-syntax.patch deleted file mode 100644 index c2d108f..0000000 --- a/0001-Mock-in-Python-3.12-finds-more-errors-in-mock-syntax.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 7ee50abcb9b2da3a853dc8bed85a660d48d5b720 Mon Sep 17 00:00:00 2001 -From: Mattias Ellert -Date: Sat, 15 Jul 2023 17:11:30 +0200 -Subject: [PATCH] Mock in Python 3.12 finds more errors in mock syntax. - -This commit fixes these errors. ---- - .../_internal/tests/parser_obj_test.py | 23 +++++++++++-------- - .../_internal/tests/renewupdater_test.py | 2 +- - 2 files changed, 15 insertions(+), 10 deletions(-) - -diff --git a/certbot-nginx/certbot_nginx/_internal/tests/parser_obj_test.py b/certbot-nginx/certbot_nginx/_internal/tests/parser_obj_test.py -index 710b63fc4..05bc86dbc 100644 ---- a/certbot-nginx/certbot_nginx/_internal/tests/parser_obj_test.py -+++ b/certbot-nginx/certbot_nginx/_internal/tests/parser_obj_test.py -@@ -64,20 +64,23 @@ class ParsingHooksTest(unittest.TestCase): - assert Block.should_parse([['block_name'], [['many'], ['statements'], 'here']]) - assert Block.should_parse([['if', ' ', '(whatever)'], ['hi']]) - -- def test_parse_raw(self): -+ @mock.patch("certbot_nginx._internal.parser_obj.Parsable.parsing_hooks") -+ def test_parse_raw(self, parsing_hooks): - fake_parser1 = mock.Mock() - fake_parser1.should_parse = lambda x: True - fake_parser2 = mock.Mock() -- fake_parser2.should_parse = lambda x: False -+ fake_parser2.should_parse = lambda x: True -+ parsing_hooks.return_value = (fake_parser1, fake_parser2,) - # First encountered "match" should parse. - parse_raw([]) -- fake_parser1.called_once() -- fake_parser2.not_called() -+ fake_parser1().parse.assert_called_once() -+ fake_parser2().parse.assert_not_called() - fake_parser1.reset_mock() - # "match" that returns False shouldn't parse. -+ fake_parser1.should_parse = lambda x: False - parse_raw([]) -- fake_parser1.not_called() -- fake_parser2.called_once() -+ fake_parser1().parse.assert_not_called() -+ fake_parser2().parse.assert_called_once() - - @mock.patch("certbot_nginx._internal.parser_obj.Parsable.parsing_hooks") - def test_parse_raw_no_match(self, parsing_hooks): -@@ -91,13 +94,15 @@ class ParsingHooksTest(unittest.TestCase): - with pytest.raises(errors.MisconfigurationError): - parse_raw([]) - -- def test_parse_raw_passes_add_spaces(self): -+ @mock.patch("certbot_nginx._internal.parser_obj.Parsable.parsing_hooks") -+ def test_parse_raw_passes_add_spaces(self, parsing_hooks): - fake_parser1 = mock.Mock() - fake_parser1.should_parse = lambda x: True -+ parsing_hooks.return_value = (fake_parser1,) - parse_raw([]) -- fake_parser1.parse.called_with([None]) -+ fake_parser1().parse.assert_called_with([], False) - parse_raw([], add_spaces=True) -- fake_parser1.parse.called_with([None, True]) -+ fake_parser1().parse.assert_called_with([], True) - - - class SentenceTest(unittest.TestCase): -diff --git a/certbot/certbot/_internal/tests/renewupdater_test.py b/certbot/certbot/_internal/tests/renewupdater_test.py -index eab07cd34..22caae349 100644 ---- a/certbot/certbot/_internal/tests/renewupdater_test.py -+++ b/certbot/certbot/_internal/tests/renewupdater_test.py -@@ -47,7 +47,7 @@ class RenewUpdaterTest(test_util.ConfigTestCase): - lineage = mock.MagicMock() - mock_deployer = self.renew_deployer - updater.run_renewal_deployer(self.config, lineage, mock_deployer) -- assert mock_deployer.renew_deploy.called_with(lineage) -+ mock_deployer.renew_deploy.assert_called_with(lineage) - - @mock.patch("certbot._internal.updater.logger.debug") - def test_updater_skip_dry_run(self, mock_log): --- -2.41.0 - diff --git a/certbot.spec b/certbot.spec index 0a4846c..c6ca1d2 100644 --- a/certbot.spec +++ b/certbot.spec @@ -263,12 +263,7 @@ install -dm 0755 %{buildroot}%{_localstatedir}/log/letsencrypt %check for module in acme certbot %{MODULES} certbot-apache certbot-nginx; do pushd $module -%pytest -v -W "ignore:pkg_resources is deprecated as an API::pkg_resources" \ - -W "ignore:Deprecated call to \`pkg_resources.declare_namespace('sphinxcontrib')\`::pkg_resources" \ - -W "ignore:datetime.datetime.utcfromtimestamp() is deprecated:DeprecationWarning" \ - -W "ignore:datetime.datetime.utcnow() is deprecated:DeprecationWarning" \ - -W "ignore:datetime.utcfromtimestamp() is deprecated:DeprecationWarning" \ - -W "ignore:datetime.utcnow() is deprecated:DeprecationWarning" +%pytest -v popd done %endif