Bug 1831126

Summary: python-testtools fails to build with Python 3.9: New SyntaxError messages break 2 tests
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-testtoolsAssignee: Michel Lind <michel>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, kumarpraveen.nitdgp, mhroncok, michel, mplch, pviktori, python-sig, ramkrsna
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: 2020-05-16 20:51:10 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: 1785415    

Description Miro Hrončok 2020-05-04 17:12:53 UTC
python-testtools fails to build with Python 3.9.0a6:

======================================================================
FAIL: testtools.tests.test_testresult.TestNonAsciiResults.test_syntax_error_line_utf_8
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/testtools-2.4.0/testtools/tests/test_testresult.py", line 2758, in test_syntax_error_line_utf_8
    self.assertThat(
  File "/builddir/build/BUILD/testtools-2.4.0/testtools/testcase.py", line 478, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: 'Tests running...\n======================================================================\nERROR: test_syntax_error_line_utf_8.Test.runTest\n----------------------------------------------------------------------\nTraceback (most recent call last):\n  File "/tmp/TestNonAsciiResultsvfkf2v4l/test_syntax_error_line_utf_8.py", line 6, in runTest\n    import bad\n  File "/tmp/TestNonAsciiResultsvfkf2v4l/bad.py", line 1\n    \ufeff^ = 0 # paɪθən\n    ^\nSyntaxError: invalid syntax\n\nRan 1 test in 0.001s\nFAILED (failures=1)\n' does not match /.*bad.py", line 1\n\s*\^ = 0 # pa\u026a\u03b8\u0259n\n \s*\^\nSyntaxError:.*/
======================================================================
FAIL: testtools.tests.test_testresult.TestNonAsciiResultsWithUnittest.test_syntax_error_line_utf_8
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/testtools-2.4.0/testtools/tests/test_testresult.py", line 2758, in test_syntax_error_line_utf_8
    self.assertThat(
  File "/builddir/build/BUILD/testtools-2.4.0/testtools/testcase.py", line 478, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: 'E\n======================================================================\nERROR: runTest (test_syntax_error_line_utf_8.Test)\ntest_syntax_error_line_utf_8.Test.runTest\n----------------------------------------------------------------------\ntesttools.testresult.real._StringException: Traceback (most recent call last):\n  File "/tmp/TestNonAsciiResultsWithUnittestpcpincft/test_syntax_error_line_utf_8.py", line 6, in runTest\n    import bad\n  File "/tmp/TestNonAsciiResultsWithUnittestpcpincft/bad.py", line 1\n    \ufeff^ = 0 # paɪθən\n    ^\nSyntaxError: invalid syntax\n\n\n----------------------------------------------------------------------\nRan 1 test in 0.000s\n\nFAILED (errors=1)\n' does not match /.*bad.py", line 1\n\s*\^ = 0 # pa\u026a\u03b8\u0259n\n \s*\^\nSyntaxError:.*/
Ran 2625 tests in 0.660s
FAILED (failures=2)

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/fedora-rawhide-x86_64/01366280-python-testtools/

For all our attempts to build python-testtools with Python 3.9, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/python-testtools/

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

Let us know here if you have any questions.

Python 3.9 will be included in Fedora 33. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.9.
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 Michel Lind 2020-05-13 18:07:05 UTC
Oh fun. Python releases nowadays give me deja vu from the days when every GCC release breaks C++ apps :D

Comment 2 Petr Viktorin (pviktori) 2020-05-14 08:46:16 UTC
Please don't rely on the exact wording of error messages. Changing those is fair game. 


> every GCC release breaks C++ apps

As opposed to -fno-common breaking both C and C++ apps? </jab>

Comment 3 Michel Lind 2020-05-15 21:35:42 UTC
(In reply to Petr Viktorin from comment #2)
> Please don't rely on the exact wording of error messages. Changing those is
> fair game. 
> 
Yeah, I'll suggest that to upstream. The difference in output between py38 and py39 are actually very minimal.

Comment 4 Michel Lind 2020-05-16 20:51:10 UTC
Reported upstream: https://github.com/testing-cabal/testtools/pull/293

A patched version that works fine in my local Mock with Python 3.9 has been built for Rawhide (python-testtools-2.4.0-4.fc33) -- https://koji.fedoraproject.org/koji/taskinfo?taskID=44587987

Comment 5 Miro Hrončok 2020-05-16 21:39:07 UTC
Thanks.