Bug 1787902

Summary: pytest fails to build with Python 3.9
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: pytestAssignee: Miro Hrončok <mhroncok>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, mhroncok, mrunge, thomas.moschny
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-02-10 14:21:07 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-01-05 10:37:58 UTC
pytest fails to build with Python 3.9.0a2.

_______________________________ test_isparseable _______________________________

    def test_isparseable():
>       assert Source("hello").isparseable()

/builddir/build/BUILD/pytest-4.6.8/testing/code/test_source.py:130: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest._code.source.Source object at 0x7f25d53afaf0>, deindent = True

    def isparseable(self, deindent=True):
        """ return True if source is parseable, heuristically
            deindenting it by default.
        """
>       from parser import suite as syntax_checker
E       DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python

/builddir/build/BUILDROOT/pytest-4.6.8-1.fc32.x86_64/usr/lib/python3.9/site-packages/_pytest/_code/source.py:126: DeprecationWarning
__________________________ TestAccesses.test_getrange __________________________

self = <test_source.TestAccesses object at 0x7f25d5c02670>

    def test_getrange(self):
        x = self.source[0:2]
>       assert x.isparseable()

/builddir/build/BUILD/pytest-4.6.8/testing/code/test_source.py:150: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest._code.source.Source object at 0x7f25d59a7190>, deindent = True

    def isparseable(self, deindent=True):
        """ return True if source is parseable, heuristically
            deindenting it by default.
        """
>       from parser import suite as syntax_checker
E       DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python

/builddir/build/BUILDROOT/pytest-4.6.8-1.fc32.x86_64/usr/lib/python3.9/site-packages/_pytest/_code/source.py:126: DeprecationWarning

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

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

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, but the initial bootstrapping has already started.
A build failure this early in the bootstrap sequence blocks us very much.

Comment 1 Miro Hrončok 2020-01-05 11:50:01 UTC
pytest 5 has the same problem.

this patch workarounds it before the upstream fix:

--- a/tox.ini
+++ b/tox.ini
@@ -168,6 +168,8 @@ filterwarnings =
     default:invalid escape sequence:DeprecationWarning
     # ignore use of unregistered marks, because we use many to test the implementation
     ignore::_pytest.warning_types.PytestUnknownMarkWarning
+    # https://github.com/pytest-dev/pytest/issues/6404
+    ignore:.*The parser module is deprecated.*:DeprecationWarning
 pytester_example_dir = testing/example_scripts
 markers =
     # dummy markers for testing

Comment 2 Miro Hrončok 2020-02-10 14:21:07 UTC
I've backported the upstream fix from https://github.com/pytest-dev/pytest/commit/f606fef19d035719be6ed862f7f426a0e7c582e1