[all] testtools and support for Python 3.10 (error du to deprecation of distutils)
Hi, When I try to build rally-openstack, I get this, in the test discovery: /usr/lib/python3/dist-packages/rally/common/cfg.py:19: in <module> from oslo_config import fixture # noqa /usr/lib/python3/dist-packages/oslo_config/fixture.py:18: in <module> import fixtures /usr/lib/python3/dist-packages/fixtures/__init__.py:81: in <module> from fixtures.fixture import ( /usr/lib/python3/dist-packages/fixtures/fixture.py:34: in <module> from fixtures.callmany import ( /usr/lib/python3/dist-packages/fixtures/callmany.py:31: in <module> MultipleExceptions = try_import( /usr/lib/python3/dist-packages/testtools/helpers.py:30: in try_import __import__(module_name) /usr/lib/python3/dist-packages/testtools/__init__.py:99: in <module> from testtools.distutilscmd import TestCommand /usr/lib/python3/dist-packages/testtools/distutilscmd.py:7: in <module> from distutils.core import Command /usr/lib/python3.10/distutils/__init__.py:19: in <module> warnings.warn(_DEPRECATION_MESSAGE, E DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives This warning makes it impossible to discover rally-openstack tests, because of the imports here: https://github.com/testing-cabal/testtools/blob/master/testtools/distutilscm... Can someone work on removing distutils support from Testtools? Or is there a way to trick pytest to not fail? Help would be greatly appreciated here. Cheers, Thomas Goirand (zigo)
On 2021-12-13 17:24:23 +0100 (+0100), Thomas Goirand wrote:
When I try to build rally-openstack, I get this, in the test discovery: [...] /usr/lib/python3.10/distutils/__init__.py:19: in <module> warnings.warn(_DEPRECATION_MESSAGE, E DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives [...] Can someone work on removing distutils support from Testtools? Or is there a way to trick pytest to not fail? Help would be greatly appreciated here.
PYTHONWARNINGS must be getting set to "error" somewhere. Are you setting it at invocation maybe? In order to be able to run with dependencies that call distutils I currently do something like this: PYTHONWARNINGS = error, ignore:The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives:DeprecationWarning All on one line of course. And yes, ideally someone should fix testtools before 3.11 releases, so people can still use it on 3.12 alpha releases once those are available. -- Jeremy Stanley
Hi folks! пн, 13 дек. 2021 г. в 18:53, Jeremy Stanley <fungi@yuggoth.org>:
On 2021-12-13 17:24:23 +0100 (+0100), Thomas Goirand wrote:
When I try to build rally-openstack, I get this, in the test discovery: [...] /usr/lib/python3.10/distutils/__init__.py:19: in <module> warnings.warn(_DEPRECATION_MESSAGE, E DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives [...] Can someone work on removing distutils support from Testtools? Or is there a way to trick pytest to not fail? Help would be greatly appreciated here.
PYTHONWARNINGS must be getting set to "error" somewhere. Are you setting it at invocation maybe?
It is set via tox.ini at https://github.com/openstack/rally-openstack/blob/2.2.0/tox.ini#L122-L124 It is better to fix deprecated things earlier before they result in the broken project :)
In order to be able to run with dependencies that call distutils I currently do something like this:
PYTHONWARNINGS = error, ignore:The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives:DeprecationWarning
I'm ok to ignore the warning from testtools since it doesn't require any changes from our side. All on one line of course. And yes, ideally someone should fix
testtools before 3.11 releases, so people can still use it on 3.12 alpha releases once those are available. -- Jeremy Stanley
-- Best regards, Andrey Kurilin.
On 12/13/21 8:44 PM, Andrey Kurilin wrote:
Hi folks!
пн, 13 дек. 2021 г. в 18:53, Jeremy Stanley <fungi@yuggoth.org <mailto:fungi@yuggoth.org>>:
On 2021-12-13 17:24:23 +0100 (+0100), Thomas Goirand wrote: > When I try to build rally-openstack, I get this, in the test discovery: [...] > /usr/lib/python3.10/distutils/__init__.py:19: in <module> > warnings.warn(_DEPRECATION_MESSAGE, > E DeprecationWarning: The distutils package is deprecated and slated > for removal in Python 3.12. Use setuptools or check PEP 632 for > potential alternatives [...] > Can someone work on removing distutils support from Testtools? Or is > there a way to trick pytest to not fail? Help would be greatly > appreciated here.
PYTHONWARNINGS must be getting set to "error" somewhere. Are you setting it at invocation maybe?
It is set via tox.ini at https://github.com/openstack/rally-openstack/blob/2.2.0/tox.ini#L122-L124 <https://github.com/openstack/rally-openstack/blob/2.2.0/tox.ini#L122-L124>
It is better to fix deprecated things earlier before they result in the broken project :)
In order to be able to run with dependencies that call distutils I currently do something like this:
PYTHONWARNINGS = error, ignore:The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives:DeprecationWarning
I'm ok to ignore the warning from testtools since it doesn't require any changes from our side.
All on one line of course. And yes, ideally someone should fix testtools before 3.11 releases, so people can still use it on 3.12 alpha releases once those are available. -- Jeremy Stanley
-- Best regards, Andrey Kurilin.
Again, this happens during the *test discovery*. I'm not using Tox (package maintainer never do). FYI, I'm simply doing: python3 -m pytest tests/unit If you know how to disable the errors on warning during test discovery, let me know. But right now, this equals to FTBFS for rally-openstack in Debian (the package was removed from testing because of it...). Cheers, Thomas Goirand (zigo)
On 2021-12-13 22:08:48 +0100 (+0100), Thomas Goirand wrote:
On 12/13/21 8:44 PM, Andrey Kurilin wrote:
Hi folks!
пн, 13 дек. 2021 г. в 18:53, Jeremy Stanley <fungi@yuggoth.org <mailto:fungi@yuggoth.org>>:
On 2021-12-13 17:24:23 +0100 (+0100), Thomas Goirand wrote: > When I try to build rally-openstack, I get this, in the test discovery: [...] > /usr/lib/python3.10/distutils/__init__.py:19: in <module> > warnings.warn(_DEPRECATION_MESSAGE, > E DeprecationWarning: The distutils package is deprecated and slated > for removal in Python 3.12. Use setuptools or check PEP 632 for > potential alternatives [...] > Can someone work on removing distutils support from Testtools? Or is > there a way to trick pytest to not fail? Help would be greatly > appreciated here.
PYTHONWARNINGS must be getting set to "error" somewhere. Are you setting it at invocation maybe?
It is set via tox.ini at https://github.com/openstack/rally-openstack/blob/2.2.0/tox.ini#L122-L124 <https://github.com/openstack/rally-openstack/blob/2.2.0/tox.ini#L122-L124>
It is better to fix deprecated things earlier before they result in the broken project :) [...] Again, this happens during the *test discovery*. I'm not using Tox (package maintainer never do). FYI, I'm simply doing:
python3 -m pytest tests/unit
If you know how to disable the errors on warning during test discovery, let me know. But right now, this equals to FTBFS for rally-openstack in Debian (the package was removed from testing because of it...).
To reiterate, PYTHONWARNINGS must be getting set to "error" somewhere. Maybe it's exported in that environment before python3 is invoked? -- Jeremy Stanley
On 12/13/21 10:14 PM, Jeremy Stanley wrote:
To reiterate, PYTHONWARNINGS must be getting set to "error" somewhere. Maybe it's exported in that environment before python3 is invoked?
This returns nothing: grep -r PYTHONWARNINGS * So no, it's not what's happening, unless I don't understand... Cheers, Thomas Goirand (zigo)
On 2021-12-13 23:29:05 +0100 (+0100), Thomas Goirand wrote:
On 12/13/21 10:14 PM, Jeremy Stanley wrote:
To reiterate, PYTHONWARNINGS must be getting set to "error" somewhere. Maybe it's exported in that environment before python3 is invoked?
This returns nothing: grep -r PYTHONWARNINGS *
So no, it's not what's happening, unless I don't understand...
Are you able to reproduce it locally? Under sbuild or some other way? -- Jeremy Stanley
On 12/13/21 11:34 PM, Jeremy Stanley wrote:
On 2021-12-13 23:29:05 +0100 (+0100), Thomas Goirand wrote:
On 12/13/21 10:14 PM, Jeremy Stanley wrote:
To reiterate, PYTHONWARNINGS must be getting set to "error" somewhere. Maybe it's exported in that environment before python3 is invoked?
This returns nothing: grep -r PYTHONWARNINGS *
So no, it's not what's happening, unless I don't understand...
Are you able to reproduce it locally? Under sbuild or some other way?
Yep. Doing this: git clone https://salsa.debian.org/openstack-team/services/rally-openstack.git cd rally-openstack sbuild ... Cheers, Thomas Goirand (zigo)
On Mon, 2021-12-13 at 23:50 +0100, Thomas Goirand wrote:
On 12/13/21 11:34 PM, Jeremy Stanley wrote:
On 2021-12-13 23:29:05 +0100 (+0100), Thomas Goirand wrote:
On 12/13/21 10:14 PM, Jeremy Stanley wrote:
To reiterate, PYTHONWARNINGS must be getting set to "error" somewhere. Maybe it's exported in that environment before python3 is invoked?
This returns nothing: grep -r PYTHONWARNINGS *
So no, it's not what's happening, unless I don't understand...
Are you able to reproduce it locally? Under sbuild or some other way?
Yep. Doing this:
git clone https://salsa.debian.org/openstack-team/services/rally-openstack.git cd rally-openstack sbuild ...
You might not be using tox, but pytest will still loading configuration from that file if it exists [1][2][3] Stephen [1] https://docs.pytest.org/en/7.0.x/reference/customize.html#tox-ini [2] https://docs.pytest.org/en/7.0.x/how-to/capture-warnings.html [3] https://github.com/openstack/rally/blob/0f0f20dab/tox.ini#L151-L163
Cheers,
Thomas Goirand (zigo)
participants (4)
-
Andrey Kurilin
-
Jeremy Stanley
-
Stephen Finucane
-
Thomas Goirand