From cc1c134aa3d3976959616a42758aa23bdbad435b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Sun, 29 Sep 2024 12:25:26 +0000 Subject: [PATCH] drop python<=3.7 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to https://endoflife.date/python python 3.7 has been EOSed 27 Jun 2023. Filter all code over `pyupgracde --py38-plus`. Signed-off-by: Tomasz Kłoczko --- check_manifest.py | 2 +- tests.py | 20 +++----------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/check_manifest.py b/check_manifest.py index 0766969..d38927f 100755 --- a/check_manifest.py +++ b/check_manifest.py @@ -137,7 +137,7 @@ def format_missing(missing_from_a, missing_from_b, name_a, name_b): class CommandFailed(Failure): def __init__(self, command: List[str], status: int, output: str) -> None: - super().__init__("%s failed (status %s):\n%s" % ( + super().__init__("{} failed (status {}):\n{}".format( command, status, output)) diff --git a/tests.py b/tests.py index 8a2df44..7ee138e 100644 --- a/tests.py +++ b/tests.py @@ -18,21 +18,7 @@ from xml.etree import ElementTree as ET -if sys.version_info >= (3, 8): - from unittest import mock -else: - # unittest.mock in 3.7 is too old to support - # all the features used in the test suite - import mock - -from check_manifest import rmtree - - -CAN_SKIP_TESTS = os.getenv('SKIP_NO_TESTS', '') == '' - - -try: - codecs.lookup('oem') +from unittest import mock except LookupError: HAS_OEM_CODEC = False else: @@ -115,7 +101,7 @@ def test_run_no_such_program(self): should_start_with = "could not run ['there-is-really-no-such-program']:" self.assertTrue( str(cm.exception).startswith(should_start_with), - '\n%r does not start with\n%r' % (str(cm.exception), + '\n{!r} does not start with\n{!r}'.format(str(cm.exception), should_start_with)) def test_mkdtemp_readonly_files(self): @@ -179,7 +165,7 @@ def test_copy_files(self): 'cp a %s' % n('/dest/dir/a'), 'mkdir %s' % n('/dest/dir/b'), 'makedirs %s' % n('/dest/dir/c/d'), - 'cp %s %s' % (n('c/d/e'), n('/dest/dir/c/d/e')), + 'cp {} {}'.format(n('c/d/e'), n('/dest/dir/c/d/e')), ]) def test_get_one_file_in(self):