Skip to content

FAILED tests/test_packaging.py - New contributor needs help #1490

@ani0075saha

Description

@ani0075saha

I followed the steps in CONTRIBUTING.md to setup my local development environment, but got a couple of failed tests.

(attrs-dev) ani0075saha:attrs$ uv run pytest
Using CPython 3.13.11 interpreter at: /home/ani0075saha/anaconda3/envs/attrs-dev/bin/python3
Creating virtual environment at: .venv
      Built attrs @ file:///home/ani0075saha/Code/personal/attrs
Installed 14 packages in 8ms
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.13.11, pytest-8.4.2, pluggy-1.6.0
rootdir: /home/ani0075saha/Code/personal/attrs
configfile: pyproject.toml
testpaths: tests
plugins: xdist-3.8.0, hypothesis-6.143.1
collected 1371 items                                                                                                                                                                                              

tests/test_3rd_party.py .                                                                                                                                                                                   [  0%]
tests/test_abc.py ....                                                                                                                                                                                      [  0%]
tests/test_annotations.py ...............................................                                                                                                                                   [  3%]
tests/test_cmp.py ..............................................................................                                                                                                            [  9%]
tests/test_compat.py ...                                                                                                                                                                                    [  9%]
tests/test_config.py ....                                                                                                                                                                                   [  9%]
tests/test_converters.py ......................................                                                                                                                                             [ 12%]
tests/test_dunders.py ...................................................................................................                                                                                   [ 19%]
tests/test_filters.py .................................                                                                                                                                                     [ 22%]
tests/test_funcs.py .....................................................                                                                                                                                   [ 26%]
tests/test_functional.py .................................................................................................................................................................................. [ 39%]
........................................................................................................................................................................................................... [ 54%]
.............................                                                                                                                                                                               [ 56%]
tests/test_hooks.py ..............                                                                                                                                                                          [ 57%]
tests/test_import.py .                                                                                                                                                                                      [ 57%]
tests/test_init_subclass.py ....                                                                                                                                                                            [ 57%]
tests/test_make.py ........................................................................................................................................................................................ [ 70%]
..............................................................................s.......                                                                                                                      [ 77%]
tests/test_next_gen.py ....................................                                                                                                                                                 [ 79%]
tests/test_packaging.py ....FF                                                                                                                                                                              [ 80%]
tests/test_pattern_matching.py .....                                                                                                                                                                        [ 80%]
tests/test_pyright.py sss                                                                                                                                                                                   [ 80%]
tests/test_setattr.py ..................x..................                                                                                                                                                 [ 83%]
tests/test_slots.py ..............s.......................................                                                                                                                                  [ 87%]
tests/test_utils.py ..                                                                                                                                                                                      [ 87%]
tests/test_validators.py ..................................................................................................................................................................                 [ 99%]
tests/test_version_info.py .......                                                                                                                                                                          [100%]

==================================================================================================== FAILURES =====================================================================================================
_________________________________________________________________________________ TestLegacyMetadataHack.test_version_info[attr] __________________________________________________________________________________

self = <tests.test_packaging.TestLegacyMetadataHack object at 0x72fbf53ea9f0>, recwarn = WarningsRecorder(record=True), mod = <module 'attr' from '/home/ani0075saha/Code/personal/attrs/src/attr/__init__.py'>

    def test_version_info(self, recwarn, mod):
        """
        ___version_info__ is not deprecated, therefore doesn't raise a warning
        and parses correctly.
        """
>       assert isinstance(mod.__version_info__, attr.VersionInfo)
                          ^^^^^^^^^^^^^^^^^^^^

tests/test_packaging.py:41: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/attr/__init__.py:97: in __getattr__
    return VersionInfo._from_version_string(meta["version"])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'attr._version_info.VersionInfo'>, s = '0.1.dev1729'

    @classmethod
    def _from_version_string(cls, s):
        """
        Parse *s* and return a _VersionInfo.
        """
        v = s.split(".")
        if len(v) == 3:
            v.append("final")
    
        return cls(
>           year=int(v[0]), minor=int(v[1]), micro=int(v[2]), releaselevel=v[3]
                                                   ^^^^^^^^^
        )
E       ValueError: invalid literal for int() with base 10: 'dev1729'

src/attr/_version_info.py:48: ValueError
_________________________________________________________________________________ TestLegacyMetadataHack.test_version_info[attrs] _________________________________________________________________________________

self = <tests.test_packaging.TestLegacyMetadataHack object at 0x72fbf5349040>, recwarn = WarningsRecorder(record=True), mod = <module 'attrs' from '/home/ani0075saha/Code/personal/attrs/src/attrs/__init__.py'>

    def test_version_info(self, recwarn, mod):
        """
        ___version_info__ is not deprecated, therefore doesn't raise a warning
        and parses correctly.
        """
>       assert isinstance(mod.__version_info__, attr.VersionInfo)
                          ^^^^^^^^^^^^^^^^^^^^

tests/test_packaging.py:41: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/attr/__init__.py:97: in __getattr__
    return VersionInfo._from_version_string(meta["version"])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'attr._version_info.VersionInfo'>, s = '0.1.dev1729'

    @classmethod
    def _from_version_string(cls, s):
        """
        Parse *s* and return a _VersionInfo.
        """
        v = s.split(".")
        if len(v) == 3:
            v.append("final")
    
        return cls(
>           year=int(v[0]), minor=int(v[1]), micro=int(v[2]), releaselevel=v[3]
                                                   ^^^^^^^^^
        )
E       ValueError: invalid literal for int() with base 10: 'dev1729'

src/attr/_version_info.py:48: ValueError
============================================================================================= short test summary info =============================================================================================
SKIPPED [1] tests/test_make.py:2929: Pre-3.10 only.
SKIPPED [1] tests/test_pyright.py:35: Requires pyright.
SKIPPED [1] tests/test_pyright.py:83: Requires pyright.
SKIPPED [1] tests/test_pyright.py:111: Requires pyright.
SKIPPED [1] tests/test_slots.py:517: slots without weakref_slot should only work on PyPy
XFAIL tests/test_setattr.py::TestSetAttr::test_slotted_confused
FAILED tests/test_packaging.py::TestLegacyMetadataHack::test_version_info[attr] - ValueError: invalid literal for int() with base 10: 'dev1729'
FAILED tests/test_packaging.py::TestLegacyMetadataHack::test_version_info[attrs] - ValueError: invalid literal for int() with base 10: 'dev1729'
============================================================================== 2 failed, 1363 passed, 5 skipped, 1 xfailed in 6.75s ===============================================================================

I have installed uv, tox and tox-uv plugins inside a conda environment attrs-dev. It will great if someone can point out if this is being caused by my local development environment. I am not a seasoned uv user. Here's additional information which might help.

(attrs-dev) ani0075saha:attrs$ uv pip list
Using Python 3.13.11 environment at: /home/ani0075saha/anaconda3/envs/attrs-dev
Package    Version
---------- -------
pip        25.3
setuptools 80.9.0
uv         0.9.17
wheel      0.45.1
(attrs-dev) ani0075saha:attrs$ conda list
# packages in environment at /home/ani0075saha/anaconda3/envs/attrs-dev:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             5.1                       1_gnu  
bzip2                     1.0.8                h5eee18b_6  
ca-certificates           2025.12.2            h06a4308_0  
ld_impl_linux-64          2.44                 h153f514_2  
libexpat                  2.7.3                h7354ed3_4  
libffi                    3.4.4                h6a678d5_1  
libgcc                    15.2.0               h69a1729_7  
libgcc-ng                 15.2.0               h166f726_7  
libgomp                   15.2.0               h4751f2c_7  
libmpdec                  4.0.0                h5eee18b_0  
libstdcxx                 15.2.0               h39759b7_7  
libstdcxx-ng              15.2.0               hc03a8fd_7  
libuuid                   1.41.5               h5eee18b_0  
libxcb                    1.17.0               h9b100fa_0  
libzlib                   1.3.1                hb25bd0a_0  
ncurses                   6.5                  h7934f7d_0  
openssl                   3.0.18               hd6dcaed_0  
pip                       25.3               pyhc872135_0  
pthread-stubs             0.3                  h0ce48e5_1  
python                    3.13.11         hcf712cf_100_cp313  
python_abi                3.13                    3_cp313  
readline                  8.3                  hc2a1206_0  
setuptools                80.9.0          py313h06a4308_0  
sqlite                    3.51.0               h2a70700_0  
tk                        8.6.15               h54e0aa7_0  
tzdata                    2025b                h04d1e81_0  
uv                        0.9.17                   pypi_0    pypi
wheel                     0.45.1          py313h06a4308_0  
xorg-libx11               1.8.12               h9b100fa_1  
xorg-libxau               1.0.12               h9b100fa_0  
xorg-libxdmcp             1.1.5                h9b100fa_0  
xorg-xorgproto            2024.1               h5eee18b_1  
xz                        5.6.4                h5eee18b_1  
zlib                      1.3.1                hb25bd0a_0  
(attrs-dev) ani0075saha:attrs$ uv python list --only-installed
cpython-3.13.11-linux-x86_64-gnu    /home/ani0075saha/anaconda3/envs/attrs-dev/bin/python3.13
cpython-3.13.11-linux-x86_64-gnu    /home/ani0075saha/anaconda3/envs/attrs-dev/bin/python3 -> python3.13
cpython-3.13.11-linux-x86_64-gnu    /home/ani0075saha/anaconda3/envs/attrs-dev/bin/python -> python3.13
cpython-3.10.12-linux-x86_64-gnu    /usr/bin/python3.10
cpython-3.10.12-linux-x86_64-gnu    /usr/bin/python3 -> python3.10
(attrs-dev) ani0075saha:attrs$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
(attrs-dev) ani0075saha:attrs$ uname -r
6.8.0-87-generic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions