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

6.1.0: running self tests #2465

Open
0-wiz-0 opened this issue Oct 22, 2024 · 4 comments
Open

6.1.0: running self tests #2465

0-wiz-0 opened this issue Oct 22, 2024 · 4 comments

Comments

@0-wiz-0
Copy link
Contributor

0-wiz-0 commented Oct 22, 2024

In 6.1.0 the test system was switched from unittest to pytest. I've updated the package in pkgsrc using the pypi source distfile, but I can't run the tests any longer. Using the command line from HISTORY.rst:

/usr/pkg/bin/python3.12 -m psutil.tests
/usr/pkg/bin/python3.12: Error while finding module specification for 'psutil.tests' (ImportError: cannot import name '_psutil_bsd' from partially initialized module 'psutil' (most likely due to a circular import) (/scratch/sysutils/py-psutil/work/psutil-6.1.0/psutil/__init__.py))

Using pytest directly, from the top level:

====================================================================================== test session starts =======================================================================================
platform netbsd10 -- Python 3.12.7, pytest-8.3.3, pluggy-1.5.0
rootdir: /scratch/sysutils/py-psutil/work/psutil-6.1.0
configfile: pyproject.toml
collected 0 items / 16 errors

============================================================================================= ERRORS =============================================================================================
___________________________________________________________________________ ERROR collecting psutil/tests/test_aix.py ____________________________________________________________________________
ImportError while importing test module '/scratch/sysutils/py-psutil/work/psutil-6.1.0/psutil/tests/test_aix.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/pkg/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
psutil/__init__.py:127: in <module>
    from . import _psbsd as _psplatform
psutil/_psbsd.py:17: in <module>
    from . import _psutil_bsd as cext
E   ImportError: cannot import name '_psutil_bsd' from partially initialized module 'psutil' (most likely due to a circular import) (/scratch/sysutils/py-psutil/work/psutil-6.1.0/psutil/__init__
.py)
___________________________________________________________________________ ERROR collecting psutil/tests/test_bsd.py ____________________________________________________________________________
...

It doesn't matter if I install the package first or not.
In case it matters, in pkgsrc, the package is built using:

/usr/pkg/bin/python3.12  -m build --wheel --skip-dependency-check --no-isolation

What is the proper way to run the tests now?
Thanks.

@0-wiz-0 0-wiz-0 added the bug label Oct 22, 2024
@github-actions github-actions bot added the tests label Oct 22, 2024
@giampaolo
Copy link
Owner

Hi Thomas. The error looks unrelated with pytest. Usually that means a broken psutil installation (e.g. after a psutil upgrade). You can try:

make clean uninstall install

@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented Oct 22, 2024

Hi Giampaolo! No, that's not it, the tests are run in an empty sandbox, there is no psutil installed there.

@giampaolo
Copy link
Owner

Can you import psutil? I mean python3 -c "import psutil"?

@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented Oct 22, 2024

If I install psutil (which doesn't make a difference for the test) then yes:

# python3.12 -c "import psutil"
# 

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

No branches or pull requests

2 participants