Open maribu opened 2 months ago
With the latest release (0.8.2) using Python 3.12.3 the following unit test fails:
_____________________________________________ TestDefaultOrderedDict.test_simple ______________________________________________ self = <simplesat.utils.tests.test_collections.TestDefaultOrderedDict testMethod=test_simple> def test_simple(self): # Given data = DefaultOrderedDict(list) # When data[1].append(1) data[0].append(0) # Then self.assertEqual(list(data.keys()), [1, 0]) self.assertEqual(data[0], [0]) self.assertEqual(data[1], [1]) self.assertEqual(data[2], []) if sys.version_info[0] == 2: r_repr = ("DefaultOrderedDict(<type 'list'>, " "DefaultOrderedDict([(1, [1]), (0, [0]), (2, [])]))") else: r_repr = ("DefaultOrderedDict(<class 'list'>, " "DefaultOrderedDict([(1, [1]), (0, [0]), (2, [])]))") > self.assertEqual(repr(data), r_repr) E AssertionError: "Defa[19 chars]ss 'list'>, DefaultOrderedDict({1: [1], 0: [0], 2: []}))" != "Defa[19 chars]ss 'list'>, DefaultOrderedDict([(1, [1]), (0, [0]), (2, [])]))" E - DefaultOrderedDict(<class 'list'>, DefaultOrderedDict({1: [1], 0: [0], 2: []})) E ? ^ ^ ^ ^ ^ E + DefaultOrderedDict(<class 'list'>, DefaultOrderedDict([(1, [1]), (0, [0]), (2, [])])) E ? ^^ ^ + + ^ + + ^ ^^ simplesat/utils/tests/test_collections.py:32: AssertionError
It was actually run using Alpine Linux package builder, but the steps boil down to:
Then running:
pkgver=0.8.2 echo "version = '$pkgver'" > simplesat/_version.py echo "version_tuple = ($(echo $pkgver | sed -e 's/\./, /g'))" >> simplesat/_version.py rm -r old gpep517 build-wheel \ --wheel-dir dist \ --output-fd 3 3>&1 >&2 python3 -m venv --clear --without-pip --system-site-packages ./testenv ./testenv/bin/python3 -m installer dist/*.whl env PATH="$(pwd)/testenv/bin:$PATH" ./testenv/bin/python3 \ -m pytest -v
With the latest release (0.8.2) using Python 3.12.3 the following unit test fails:
Full output
``` /home/maribu/Repos/software/aports/master/testing/py3-simplesat/src/testenv/lib/python3.12/site-packages/simplesat/package.py:68: SyntaxWarning: invalid escape sequence '\i' """ Return a new PackageMetdata object. /home/maribu/Repos/software/aports/master/testing/py3-simplesat/src/testenv/lib/python3.12/site-packages/simplesat/constraints/package_parser.py:14: SyntaxWarning: invalid escape sequence '\w' CONSTRAINT_BLOCK_RC = re.compile("(?PSteps to reproduce
It was actually run using Alpine Linux package builder, but the steps boil down to:
Replacing `assertRaisesRegexp` with `assertRaisesRegex` for compatibility with python >= 3.12
``` patch This replaces assertRaisesRegexp with assertRaisesRegex for compatibility with python >= 3.12. diff --color -rupN a/simplesat/constraints/tests/test_package_parser.py b/simplesat/constraints/tests/test_package_parser.py --- a/simplesat/constraints/tests/test_package_parser.py 2019-10-08 14:40:38.000000000 +0200 +++ b/simplesat/constraints/tests/test_package_parser.py 2024-07-04 15:35:07.408091882 +0200 @@ -22,7 +22,7 @@ class TestPrettyPackageStringParser(unit r_message = "Invalid preamble: " # Then - with self.assertRaisesRegexp(ValueError, r_message): + with self.assertRaisesRegex(ValueError, r_message): parse(package_string) # Given @@ -30,7 +30,7 @@ class TestPrettyPackageStringParser(unit r_message = "Invalid preamble: 'numpy'" # Then - with self.assertRaisesRegexp(ValueError, r_message): + with self.assertRaisesRegex(ValueError, r_message): parse(package_string) # Given @@ -38,7 +38,7 @@ class TestPrettyPackageStringParser(unit r_message = ("Invalid preamble: ") # Then - with self.assertRaisesRegexp(ValueError, r_message): + with self.assertRaisesRegex(ValueError, r_message): parse(package_string) # Given @@ -46,7 +46,7 @@ class TestPrettyPackageStringParser(unit r_message = ("Invalid preamble: ") # Then - with self.assertRaisesRegexp(ValueError, r_message): + with self.assertRaisesRegex(ValueError, r_message): parse(package_string) # Given @@ -54,7 +54,7 @@ class TestPrettyPackageStringParser(unit r_message = ("Invalid preamble: ") # Then - with self.assertRaisesRegexp(ValueError, r_message): + with self.assertRaisesRegex(ValueError, r_message): parse(package_string) # Given @@ -63,7 +63,7 @@ class TestPrettyPackageStringParser(unit "Unknown constraint kind: 'disparages'") # When - with self.assertRaisesRegexp(ValueError, r_message): + with self.assertRaisesRegex(ValueError, r_message): parse(package_string) def test_depends_simple(self): @@ -216,7 +216,7 @@ class TestPrettyPackageStringParser(unit "Unknown constraint kind: 'conflits'") # Then - with self.assertRaisesRegexp(ValueError, r_message): + with self.assertRaisesRegex(ValueError, r_message): parse(package_string) # Given diff --color -rupN a/simplesat/tests/test_pool.py b/simplesat/tests/test_pool.py --- a/simplesat/tests/test_pool.py 2019-10-08 14:40:38.000000000 +0200 +++ b/simplesat/tests/test_pool.py 2024-07-04 15:35:07.411425195 +0200 @@ -166,7 +166,7 @@ class TestPool(unittest.TestCase): constraint_re = re.escape(constraint) # Then - with self.assertRaisesRegexp(InvalidConstraint, constraint_re): + with self.assertRaisesRegex(InvalidConstraint, constraint_re): Pool([repository]) def test_accept_anyversion_constraint_on_provides_metadata(self): ```Then running: