Bug 2245827

Summary: pyzor fails to build with Python 3.13: 'Logger' object has no attribute 'warn'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: pyzorAssignee: Andreas Thienemann <andreas>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 40CC: andreas, j, ksurma, lucilanga, mhroncok, redhat-bugzilla
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pyzor-1.0.0-39.20240609git2be00c3.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-09 13:01:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2244836    

Description Karolina Surma 2023-10-24 08:55:35 UTC
pyzor fails to build with Python 3.13.0a1.

Example test failure:

______________________ RequestHandlerTest.test_invalid_pv ______________________

self = <tests.unit.test_server.RequestHandlerTest testMethod=test_invalid_pv>

    def test_invalid_pv(self):
        self.request["Op"] = "ping"
        self.request["PV"] = "ab2.13"
    
        handler = pyzor.server.RequestHandler(self.request)
    
        self.expected_response["Code"] = "400"
        self.expected_response["Diag"] = "Bad request"
>       self.check_response(handler)

tests/unit/test_server.py:359: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/unit/test_server.py:112: in check_response
    self.assertEqual(result, self.expected_response)
E   AssertionError: {'Code': '500', 'Diag': 'Internal Server Error', 'PV': '2.1', 'Thread': '3597'} != {'Code': '400', 'Diag': 'Bad request', 'PV': '2.1', 'Thread': '3597'}
E   - {'Code': '500', 'Diag': 'Internal Server Error', 'PV': '2.1', 'Thread': '3597'}
E   ?           ^              ^^ ------------------
E   
E   + {'Code': '400', 'Diag': 'Bad request', 'PV': '2.1', 'Thread': '3597'}
E   ?           ^              ^^^^^^^^^^
------------------------------ Captured log call -------------------------------
ERROR    pyzord-usage:server.py:305 500: Internal Server Error: 'Logger' object has no attribute 'warn'
ERROR    pyzord:server.py:237 Traceback (most recent call last):
  File "/builddir/build/BUILD/pyzor-f46159bd6519cebcebf59e9334a7920371111d75/pyzor/server.py", line 272, in _really_handle
    if int(float(request["PV"])) != int(pyzor.proto_version):
           ^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: 'ab2.13'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/pyzor-f46159bd6519cebcebf59e9334a7920371111d75/pyzor/server.py", line 224, in handle
    self._really_handle()
  File "/builddir/build/BUILD/pyzor-f46159bd6519cebcebf59e9334a7920371111d75/pyzor/server.py", line 275, in _really_handle
    self.server.log.warn("Invalid PV: %s", request["PV"])
    ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Logger' object has no attribute 'warn'
=========================== short test summary info ============================
FAILED tests/unit/test_account.py::LoadAccountTest::test_load_accounts_invalid_key
FAILED tests/unit/test_account.py::LoadAccountTest::test_load_accounts_invalid_line
FAILED tests/unit/test_account.py::LoadAccountTest::test_load_accounts_invalid_missing_comma
FAILED tests/unit/test_account.py::LoadAccountTest::test_load_accounts_invalid_port
FAILED tests/unit/test_account.py::LoadAccountTest::test_load_accounts_nothing
FAILED tests/unit/test_config.py::TestPasswdLoad::test_invalid_line - Attribu...
FAILED tests/unit/test_config.py::TestAccessLoad::test_invalid_action - Attri...
FAILED tests/unit/test_config.py::TestAccessLoad::test_invalid_line - Attribu...
FAILED tests/unit/test_server.py::RequestHandlerTest::test_invalid_pv - Asser...
======================== 9 failed, 152 passed in 4.47s =========================

According to https://docs.python.org/3.13/whatsnew/3.13.html:

logging: Remove undocumented and untested Logger.warn() and LoggerAdapter.warn() methods and logging.warn() function.
Deprecated since Python 3.3, they were aliases to the logging.Logger.warning() method,
logging.LoggerAdapter.warning() method and logging.warning() function.
(Contributed by Victor Stinner in gh-105376.)


https://docs.python.org/3.13/whatsnew/3.13.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06558072-pyzor/

For all our attempts to build pyzor with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/pyzor/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Aoife Moloney 2024-02-15 23:01:15 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.