containers / podman-py

Python bindings for Podman's RESTful API
Apache License 2.0
252 stars 94 forks source link

Unit tests don't work #331

Open keuko opened 1 year ago

keuko commented 1 year ago

Hi,

I would like to build debian package for podman-py. Currently If i am trying to build the package , pytest fail, can u help me ?

Build :

. . . writing manifest file 'podman.egg-info/SOURCES.txt' dh_auto_test -O--buildsystem=pybuild pybuild --test --test-pytest -i python{version} -p 3.11 I: pybuild base:291: cd /<>/.pybuild/cpython3_3.11_podman/build; python3.11 -m pytest ============================= test session starts ============================== platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0 rootdir: /<>/.pybuild/cpython3_3.11_podman/build configfile: pyproject.toml plugins: requests-mock-1.9.3 collected 0 items

============================ no tests ran in 0.03s ============================= E: pybuild pybuild:395: test: plugin distutils failed with: exit code=5: cd /<>/.pybuild/cpython3_3.11_podman/build; python3.11 -m pytest rm -fr -- /tmp/dh-xdg-rundir-gN5UfwCa dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.11 returned exit code 13 make: *** [debian/rules:12: binary] Error 25 dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2

Pytest in CWD of podman git :

root@debian-sid-builder:/build/python-podman# pytest =============================================================================================== test session starts =============================================================================================== platform linux -- Python 3.11.2, pytest-7.2.1, pluggy-1.0.0+repack rootdir: /build/python-podman, configfile: pyproject.toml plugins: xdist-3.1.0, relaxed-1.0.0 collected 0 items / 1 error

===================================================================================================== ERRORS ====================================================================================================== __ ERROR collecting test session __ Direct construction of pytest_relaxed.classes.SpecModule has been deprecated, please use pytest_relaxed.classes.SpecModule.from_parent. See https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent for more details. ============================================================================================= short test summary info ============================================================================================= ERROR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ================================================================================================ 1 error in 0.19s ================================================================================================= root@debian-sid-builder:/build/python-podman#

Thanks

rhatdan commented 1 year ago

@jwhonce @umohnani8 @siretart PTAL

rhatdan commented 1 year ago

@keuko Can you make the change to:


Direct construction of pytest_relaxed.classes.SpecModule has been deprecated, please use pytest_relaxed.classes.SpecModule.from_parent.
See https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent for more details.```

It might be that Fedora is more lenient about this then Debian.
jwhonce commented 1 year ago

I suspect this is a dependency version issue as @rhatdan implied. The podman-py test suite does not currently lock down any versions for pytest. It uses the unittest library from the running python interrupter. But the supporting libraries fixtures or requests-mock could be the issue, they are also not locked down to any version.

Allowing the versions to float allows us to attempt to support python versions 3.6-3.11 across different platforms. It may be biting us here.