Bug 2342558

Summary: python-howdoi fails to build with Python 3.14: AssertionError: 'ERROR: Unable to reach google. Do you need to use a proxy? + json.decoder.JSONDecodeError
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-howdoiAssignee: Michel Lind <michel>
Status: ASSIGNED --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fti-bugs, ksurma, mhroncok, michel
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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: 2322407, 2339432, 2339435    

Description Karolina Surma 2025-01-28 11:12:37 UTC
python-howdoi fails to build with Python 3.14.0a4.

_________________________ HowdoiTestCase.test_all_text _________________________

self = <test_howdoi.HowdoiTestCase testMethod=test_all_text>

    def test_all_text(self):
        query = self.queries[0]
        first_answer = howdoi.howdoi(query)
        second_answer = howdoi.howdoi(query + ' -a')
>       self.assertNotEqual(first_answer, second_answer)
E       AssertionError: 'ERROR: \x1b[91mUnable to reach google. Do you need to use a proxy?\n\x1b[0m' == 'ERROR: \x1b[91mUnable to reach google. Do you need to use a proxy?\n\x1b[0m'

test_howdoi.py:174: AssertionError
______________ HowdoiTestCase.test_answer_links_using_all_option _______________

self = <test_howdoi.HowdoiTestCase testMethod=test_answer_links_using_all_option>

    def test_answer_links_using_all_option(self):
        for query in self.queries:
            response = howdoi.howdoi(query + ' -a')
>           self.assertNotEqual(re.match(r'.*http.?://.*questions/\d.*', response, re.DOTALL), None)
E           AssertionError: None == None

test_howdoi.py:162: AssertionError
_______________ HowdoiTestCase.test_answer_links_using_l_option ________________

self = <test_howdoi.HowdoiTestCase testMethod=test_answer_links_using_l_option>

    def test_answer_links_using_l_option(self):
        for query in self.queries:
            response = howdoi.howdoi(query + ' -l')
>           self.assertNotEqual(re.match(r'http.?://.*questions/\d.*', response, re.DOTALL), None)
E           AssertionError: None == None

test_howdoi.py:157: AssertionError
_______________________ HowdoiTestCase.test_json_output ________________________

self = <test_howdoi.HowdoiTestCase testMethod=test_json_output>

    def test_json_output(self):
        query = self.queries[0]
        txt_answer = howdoi.howdoi(query)
        json_answer = howdoi.howdoi(query + ' -j')
        link_answer = howdoi.howdoi(query + ' -l')
>       json_answer = json.loads(json_answer)[0]

test_howdoi.py:182: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.14/json/__init__.py:346: in loads
    return _default_decoder.decode(s)
/usr/lib64/python3.14/json/decoder.py:345: in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <json.decoder.JSONDecoder object at 0x7f8c02568440>
s = 'ERROR: \x1b[91mUnable to reach google. Do you need to use a proxy?\n\x1b[0m'
idx = 0

    def raw_decode(self, s, idx=0):
        """Decode a JSON document from ``s`` (a ``str`` beginning with
        a JSON document) and return a 2-tuple of the Python
        representation and the index in ``s`` where the document ended.
    
        This can be used to decode a JSON document from a string that may
        have extraneous data at the end.
    
        """
        try:
            obj, end = self.scan_once(s, idx)
        except StopIteration as err:
>           raise JSONDecodeError("Expecting value", s, err.value) from None
E           json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

/usr/lib64/python3.14/json/decoder.py:363: JSONDecodeError
________________ HowdoiTestCase.test_missing_pre_or_code_query _________________

self = <test_howdoi.HowdoiTestCase testMethod=test_missing_pre_or_code_query>

    def test_missing_pre_or_code_query(self):
        output = howdoi.howdoi(self.query_without_code_or_pre_block)
        self.assertTrue(output)
>       self.assertIn('XML elements present in a XML', output)
E       AssertionError: 'XML elements present in a XML' not found in 'ERROR: \x1b[91mUnable to reach google. Do you need to use a proxy?\n\x1b[0m'

test_howdoi.py:279: AssertionError
_____________________ HowdoiTestCase.test_multiple_answers _____________________

self = <test_howdoi.HowdoiTestCase testMethod=test_multiple_answers>

    def test_multiple_answers(self):
        query = self.queries[0]
        first_answer = howdoi.howdoi(query)
        second_answer = howdoi.howdoi(query + ' -n3')
>       self.assertNotEqual(first_answer, second_answer)
E       AssertionError: 'ERROR: \x1b[91mUnable to reach google. Do you need to use a proxy?\n\x1b[0m' == 'ERROR: \x1b[91mUnable to reach google. Do you need to use a proxy?\n\x1b[0m'

test_howdoi.py:191: AssertionError
_________________________ HowdoiTestCase.test_position _________________________

self = <test_howdoi.HowdoiTestCase testMethod=test_position>

    def test_position(self):
        query = self.queries[0]
        first_answer = howdoi.howdoi(query)
        not_first_answer = howdoi.howdoi(query + ' -p5')
>       self.assertNotEqual(first_answer, not_first_answer)
E       AssertionError: 'ERROR: \x1b[91mUnable to reach google. Do you need to use a proxy?\n\x1b[0m' == 'ERROR: \x1b[91mUnable to reach google. Do you need to use a proxy?\n\x1b[0m'

test_howdoi.py:168: AssertionError
=========================== short test summary info ============================
FAILED test_howdoi.py::HowdoiTestCase::test_all_text - AssertionError: 'ERROR...
FAILED test_howdoi.py::HowdoiTestCase::test_answer_links_using_all_option - A...
FAILED test_howdoi.py::HowdoiTestCase::test_answer_links_using_l_option - Ass...
FAILED test_howdoi.py::HowdoiTestCase::test_json_output - json.decoder.JSONDe...
FAILED test_howdoi.py::HowdoiTestCase::test_missing_pre_or_code_query - Asser...
FAILED test_howdoi.py::HowdoiTestCase::test_multiple_answers - AssertionError...
FAILED test_howdoi.py::HowdoiTestCase::test_position - AssertionError: 'ERROR...
================= 7 failed, 17 passed, 1 deselected in 10.98s ==================

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08578109-python-howdoi/

For all our attempts to build python-howdoi with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-howdoi/

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.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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 2025-02-26 13:49:12 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.

Comment 2 Karolina Surma 2025-06-11 15:59:42 UTC
*** Bug 2371939 has been marked as a duplicate of this bug. ***