hooks/data_source: Test failure with Python 3.14 #1149

Closed
opened 2025-09-20 09:57:08 +00:00 by arkamar · 8 comments

I was forced to switch from pypi archive to git archive because pypi archive newly does not contain tests as they used too, but we need them for gentoo package. However, git archive additionally contains tests/unit/hooks/data_source tests and test_dump.py::test_convert_glob_patterns_to_borg_pattern_makes_multipart_regular_expression fails with python 3.14

====================================== FAILURES ======================================
___ test_convert_glob_patterns_to_borg_pattern_makes_multipart_regular_expression ____

    def test_convert_glob_patterns_to_borg_pattern_makes_multipart_regular_expression():
>       assert (
            module.convert_glob_patterns_to_borg_pattern(('/etc/foo/bar', '/bar/*/baz'))
            == 're:(?s:etc/foo/bar)|(?s:bar/.*/baz)'
        )
E       AssertionError: assert 're:(?s:etc/foo/bar)\\z|(?s:bar/.*/baz)\\z' == 're:(?s:etc/foo/bar)|(?s:bar/.*/baz)'
E
E         - re:(?s:etc/foo/bar)|(?s:bar/.*/baz)
E         + re:(?s:etc/foo/bar)\z|(?s:bar/.*/baz)\z
E         ?                    ++                ++


tests/unit/hooks/data_source/test_dump.py:159: AssertionError
[snip]
============================== short test summary info ===============================
FAILED tests/unit/hooks/data_source/test_dump.py::test_convert_glob_patterns_to_borg_pattern_makes_multipart_regular_expression - AssertionError: assert 're:(?s:etc/foo/bar)\\z|(?s:bar/.*/baz)\\z' == 're:(?s:etc...
============= 1 failed, 2416 passed, 1 deselected, 29 warnings in 10.03s =============
 * ERROR: app-backup/borgmatic-2.0.8::gentoo failed (test phase):
 *   pytest failed with python3.14

The issue is only related to python 3.14, older versions works.

Btw, I would be awesome if you could return test files back to pypi releases.

I was forced to switch from pypi archive to git archive because pypi archive newly does not contain tests as they used too, but we need them for gentoo package. However, git archive additionally contains `tests/unit/hooks/data_source` tests and `test_dump.py::test_convert_glob_patterns_to_borg_pattern_makes_multipart_regular_expression` fails with python 3.14 ``` ====================================== FAILURES ====================================== ___ test_convert_glob_patterns_to_borg_pattern_makes_multipart_regular_expression ____ def test_convert_glob_patterns_to_borg_pattern_makes_multipart_regular_expression(): > assert ( module.convert_glob_patterns_to_borg_pattern(('/etc/foo/bar', '/bar/*/baz')) == 're:(?s:etc/foo/bar)|(?s:bar/.*/baz)' ) E AssertionError: assert 're:(?s:etc/foo/bar)\\z|(?s:bar/.*/baz)\\z' == 're:(?s:etc/foo/bar)|(?s:bar/.*/baz)' E E - re:(?s:etc/foo/bar)|(?s:bar/.*/baz) E + re:(?s:etc/foo/bar)\z|(?s:bar/.*/baz)\z E ? ++ ++ tests/unit/hooks/data_source/test_dump.py:159: AssertionError [snip] ============================== short test summary info =============================== FAILED tests/unit/hooks/data_source/test_dump.py::test_convert_glob_patterns_to_borg_pattern_makes_multipart_regular_expression - AssertionError: assert 're:(?s:etc/foo/bar)\\z|(?s:bar/.*/baz)\\z' == 're:(?s:etc... ============= 1 failed, 2416 passed, 1 deselected, 29 warnings in 10.03s ============= * ERROR: app-backup/borgmatic-2.0.8::gentoo failed (test phase): * pytest failed with python3.14 ``` The issue is only related to python 3.14, older versions works. Btw, I would be awesome if you could return test files back to pypi releases.
Owner

Thanks for filing this! borgmatic doesn't yet support Python 3.14 alpha releases. (As you've discovered. 😄) However this test failure seems like a good thing to fix when borgmatic does add Python 3.14 support.

And the reason that tests were removed from borgmatic pypy releases is that those packages are intended for production installation, and IMO tests should not be part of production software, as among other reasons it's a larger surface area for attacks and exploits.

However, I do want to make automated builds for Gentoo and other distros convenient. Are you aware of the source release packages on the borgmatic releases page, which do contain tests?

Thanks for filing this! borgmatic doesn't yet support Python 3.14 alpha releases. (As you've discovered. 😄) However this test failure seems like a good thing to fix when borgmatic does add Python 3.14 support. And the reason that tests were removed from borgmatic pypy releases is that those packages are intended for production installation, and IMO tests should not be part of production software, as among other reasons it's a larger surface area for attacks and exploits. However, I do want to make automated builds for Gentoo and other distros convenient. Are you aware of the source release packages on the [borgmatic releases page](https://projects.torsion.org/borgmatic-collective/borgmatic/releases), which _do_ contain tests?
Contributor

I guess a point could be made that the production packages are the wheel files and that the sdist should contain all files to install & verify the package. This is how we handle it in Django at least.

I guess a point could be made that the production packages are the wheel files and that the sdist should contain all files to install & verify the package. This is how we handle it in Django at least.
Author

borgmatic doesn't yet support Python 3.14 alpha releases.

FYI, Python usually switches from alpha to beta in May. Beta release is feature freeze and several downstream distributions including Gentoo start porting python ecosystem to a new version. There is Python 3.14.0-rc3 available as of today and the final release is planned for Tuesday, 2025-10-07, see https://peps.python.org/pep-0745/.

PyPI relases

I share the point of view to wheel vs. sdist with @apollo13, thanks for the comment!

Are you aware of the source release packages on the borgmatic releases page, which do contain tests?

Yes, I am aware of them and I switched to them for now.

> borgmatic doesn't yet support Python 3.14 alpha releases. FYI, Python usually switches from alpha to beta in May. Beta release is feature freeze and several downstream distributions including Gentoo start porting python ecosystem to a new version. There is Python 3.14.0-rc3 available as of today and the final release is planned for Tuesday, 2025-10-07, see https://peps.python.org/pep-0745/. > PyPI relases I share the point of view to wheel vs. sdist with @apollo13, thanks for the comment! > Are you aware of the source release packages on the borgmatic releases page, which do contain tests? Yes, I am aware of them and I switched to them for now.
Owner

I guess a point could be made that the production packages are the wheel files and that the sdist should container all files to install & verify the package. This is how we handle it in Django at least.

Yeah, that's what I'm intending in this case. I added a brief note to borgmatic's developer documentation mentioning this. (To be deployed shortly.) Eventually this could be expanded into a full packaging guide.

borgmatic doesn't yet support Python 3.14 alpha releases.

FYI, Python usually switches from alpha to beta in May. Beta release is feature freeze and several downstream distributions including Gentoo start porting python ecosystem to a new version. There is Python 3.14.0-rc3 available as of today and the final release is planned for Tuesday, 2025-10-07, see https://peps.python.org/pep-0745/.

Oh, thanks for letting me know! For some reason I was only finding information about the alpha releases. I'll see if I can get ahold of a release candidate.

> I guess a point could be made that the production packages are the wheel files and that the sdist should container all files to install & verify the package. This is how we handle it in Django at least. Yeah, that's what I'm intending in this case. I added a brief note to borgmatic's developer documentation mentioning this. (To be deployed shortly.) Eventually this could be expanded into a full packaging guide. > > borgmatic doesn't yet support Python 3.14 alpha releases. > > FYI, Python usually switches from alpha to beta in May. Beta release is feature freeze and several downstream distributions including Gentoo start porting python ecosystem to a new version. There is Python 3.14.0-rc3 available as of today and the final release is planned for Tuesday, 2025-10-07, see https://peps.python.org/pep-0745/. Oh, thanks for letting me know! For some reason I was only finding information about the alpha releases. I'll see if I can get ahold of a release candidate.
Owner

Okay, this test is fixed in main for Python 3.14!

I guess a point could be made that the production packages are the wheel files and that the sdist should container all files to install & verify the package. This is how we handle it in Django at least.

@apollo13 Do you have an example of this? For instance, it looks like with [tool.setuptools.packages.find] in pyproject.toml, include applies to both any sdists and wheels built. I don't see a convenient way to put tests in one and not the other. Or are you using a different build backend?

Okay, this test is fixed in main for Python 3.14! > I guess a point could be made that the production packages are the wheel files and that the sdist should container all files to install & verify the package. This is how we handle it in Django at least. @apollo13 Do you have an example of this? For instance, it looks like with `[tool.setuptools.packages.find]` in `pyproject.toml`, `include` applies to both any sdists and wheels built. I don't see a convenient way to put tests in one and not the other. Or are you using a different build backend?
Contributor

You just include the production code and add the rest via MANIFEST.in I think. https://github.com/django/django/blob/main/pyproject.toml & https://github.com/django/django/blob/main/MANIFEST.in

You just `include` the production code and add the rest via MANIFEST.in I think. https://github.com/django/django/blob/main/pyproject.toml & https://github.com/django/django/blob/main/MANIFEST.in
Owner

Thanks, that did it! (Totally not intuitive IMO.) Okay @arkamar, automated tests should now be included in the source dist tarball on PyPI—in the next borgmatic release. Thanks again for filing this.

Thanks, that did it! (Totally not intuitive IMO.) Okay @arkamar, automated tests should now be included in the source dist tarball on PyPI—in the next borgmatic release. Thanks again for filing this.
Owner

Released in borgmatic 2.0.9!

Released in borgmatic 2.0.9!
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#1149