Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.1] test_parameter_name fails with Python 3.12 #4976

Closed
olebole opened this issue Dec 11, 2023 · 2 comments
Closed

[1.1] test_parameter_name fails with Python 3.12 #4976

olebole opened this issue Dec 11, 2023 · 2 comments
Labels
Milestone

Comments

@olebole
Copy link

olebole commented Dec 11, 2023

Gammapy version

Gammapy 1.1, Python 3.12

Bug description
When running the CI tests in the Debian package, I get the following failure with Python 3.12.1:

_____________________________ test_parameter_name ______________________________

    def test_parameter_name():
        with pytest.raises(RuntimeError):

>           class MyTestModel:

gammapy/modeling/models/tests/test_core.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = Parameter(name='wrong-name', value=3.0, factor=3.0, scale=1.0,
unit=Unit(dimensionless), min=nan, max=nan, frozen=False,
id=0xffff8e307aa0)
owner = <class 'gammapy.modeling.models.tests.test_core.test_parameter_name.<locals>.MyTestModel'>
name = 'par'

    def __set_name__(self, owner, name):
        if not self._name == name:
>           raise ValueError(f"Expected parameter name '{name}', got {self._name}")
E           ValueError: Expected parameter name 'par', got wrong-name
E           Error calling __set_name__ on 'Parameter' instance 'par'
in 'MyTestModel'

gammapy/modeling/parameter.py:165: ValueError

This is a regression, with Python 3.11 and otherwise identical packages, I don't see the failure.

Expected behavior

All tests should pass.

To Reproduce

Run the CI tests with Python 3.12

Other information

This was observed with the Debian package of Gammapy, when trying to rebuild for Python 3.12 support. A Debian bug was filed as #1058047. Full build log f.e. here.

@olebole olebole added the bug label Dec 11, 2023
@olebole
Copy link
Author

olebole commented Feb 3, 2024

Any progress here? Ubuntu has its Debian import freeze soon, and I would like to keep this in Ubuntu 22.04.

@registerrier registerrier added this to the 1.3 milestone Apr 22, 2024
@registerrier
Copy link
Contributor

This has been solved in #5143 . Closing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants