Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.2.0: pytest (7.2) is failing in two units #491

Closed
kloczek opened this issue Nov 27, 2022 · 3 comments
Closed

2.2.0: pytest (7.2) is failing in two units #491

kloczek opened this issue Nov 27, 2022 · 3 comments

Comments

@kloczek
Copy link

kloczek commented Nov 27, 2022

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Looks like cloudpickle test suite is failing with pytest 7.2.
Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-cloudpickle-2.2.0-4.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-cloudpickle-2.2.0-4.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.15, pytest-7.2.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/cloudpickle-2.2.0, configfile: tox.ini
collected 256 items

tests/cloudpickle_file_test.py .......
tests/cloudpickle_test.py ...................................F.....................................................................................................................F......................................................s.................................
tests/test_backward_compat.py .......

================================================================================= FAILURES =================================================================================
________________________________________________________________ CloudPickleTest.test_dynamic_pytest_module ________________________________________________________________

self = <tests.cloudpickle_test.CloudPickleTest testMethod=test_dynamic_pytest_module>

    def test_dynamic_pytest_module(self):
        # Test case for pull request https://github.com/cloudpipe/cloudpickle/pull/116
        import py

        def f():
            s = py.builtin.set([1])
            return s.pop()

        # some setup is required to allow pytest apimodules to be correctly
        # serializable.
        from cloudpickle import CloudPickler
        from cloudpickle import cloudpickle_fast as cp_fast
>       CloudPickler.dispatch_table[type(py.builtin)] = cp_fast._module_reduce
E       AttributeError: module 'py' has no attribute 'builtin'

tests/cloudpickle_test.py:1482: AttributeError
___________________________________________________________ Protocol2CloudPickleTest.test_dynamic_pytest_module ____________________________________________________________

self = <tests.cloudpickle_test.Protocol2CloudPickleTest testMethod=test_dynamic_pytest_module>

    def test_dynamic_pytest_module(self):
        # Test case for pull request https://github.com/cloudpipe/cloudpickle/pull/116
        import py

        def f():
            s = py.builtin.set([1])
            return s.pop()

        # some setup is required to allow pytest apimodules to be correctly
        # serializable.
        from cloudpickle import CloudPickler
        from cloudpickle import cloudpickle_fast as cp_fast
>       CloudPickler.dispatch_table[type(py.builtin)] = cp_fast._module_reduce
E       AttributeError: module 'py' has no attribute 'builtin'

tests/cloudpickle_test.py:1482: AttributeError
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/cloudpickle_test.py:2261: Need Pickle Protocol 5 or later
FAILED tests/cloudpickle_test.py::CloudPickleTest::test_dynamic_pytest_module - AttributeError: module 'py' has no attribute 'builtin'
FAILED tests/cloudpickle_test.py::Protocol2CloudPickleTest::test_dynamic_pytest_module - AttributeError: module 'py' has no attribute 'builtin'
================================================================ 2 failed, 253 passed, 1 skipped in 14.34s =================================================================

Here is list of installed modules in build env

Package           Version
----------------- --------------
appdirs           1.4.4
asn1crypto        1.5.1
attrs             22.1.0
bcrypt            3.2.2
Brlapi            0.8.3
build             0.9.0
cffi              1.15.1
contourpy         1.0.6
cryptography      38.0.1
cssselect         1.1.0
cycler            0.11.0
distro            1.8.0
dnspython         2.2.1
exceptiongroup    1.0.0
extras            1.0.0
fixtures          4.0.0
fonttools         4.38.0
gpg               1.17.1-unknown
iniconfig         1.1.1
kiwisolver        1.4.4
libcomps          0.1.19
louis             3.23.0
lxml              4.9.1
matplotlib        3.6.2
mock              4.0.3
numpy             1.23.1
olefile           0.46
packaging         21.3
pbr               5.9.0
pep517            0.13.0
Pillow            9.3.0
pip               22.3.1
pluggy            1.0.0
ply               3.11
psutil            5.9.2
pyasn1            0.4.8
pyasn1-modules    0.2.8
pycparser         2.21
PyGObject         3.42.2
pyparsing         3.0.9
pytest            7.2.0
python-dateutil   2.8.2
PyYAML            6.0
rpm               4.17.0
scour             0.38.2
setuptools        65.6.3
six               1.16.0
testtools         2.5.0
tomli             2.0.1
tornado           6.2
tpm2-pkcs11-tools 1.33.7
tpm2-pytss        1.1.0
typing_extensions 4.4.0
wheel             0.38.4
@ArchangeGabriel
Copy link

Related to #487.

@ogrisel
Copy link
Contributor

ogrisel commented Jan 18, 2023

Thanks, this was fixed in #494.

@ogrisel ogrisel closed this as completed Jan 18, 2023
@kloczek
Copy link
Author

kloczek commented Jan 18, 2023

IMO it is really bad looking hack 😋
Instead IMO would be better add py to tests dependencies or find that module replacement (looks li it is already kind of trend after release new pytest which has not bundled that module any more)
Just tested that with installed py pytest is ok

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-cloudpickle-2.2.0-4.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-cloudpickle-2.2.0-4.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.16, pytest-7.2.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/cloudpickle-2.2.0, configfile: tox.ini
collected 256 items

tests/cloudpickle_file_test.py .......
tests/cloudpickle_test.py ................................................................................................................................................................................................................s.................................
tests/test_backward_compat.py .......

================================================================================== short test summary info ==================================================================================
SKIPPED [1] tests/cloudpickle_test.py:2261: Need Pickle Protocol 5 or later
============================================================================== 255 passed, 1 skipped in 15.36s ==============================================================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants