13.3.5: pytest is failing because it uses no longer maintained `random2` module
See original GitHub issue- Faker version: 13.3.5
- OS: Linux x86/64
Brief summary of the issue
Looks like pytest is failing because test suite still is using outdated random2
module which was never updated for python 3.x).
Steps to reproduce
I’m trying to package 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>
Expected behavior
pytest should not fail.
Actual behavior
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-faker-13.3.5-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-faker-13.3.5-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -q
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/faker-13.3.5, configfile: setup.cfg
plugins: Faker-13.3.5
collected 1491 items / 1 error
================================================================================== ERRORS ==================================================================================
_______________________________________________________________ ERROR collecting tests/providers/test_ssn.py _______________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/faker-13.3.5/tests/providers/test_ssn.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/providers/test_ssn.py:11: in <module>
import random2
E ModuleNotFoundError: No module named 'random2'
============================================================================= warnings summary =============================================================================
../../BUILDROOT/python-faker-13.3.5-2.fc35.x86_64/usr/lib/python3.8/site-packages/faker/providers/person/fr_QC/__init__.py:10
/home/tkloczko/rpmbuild/BUILDROOT/python-faker-13.3.5-2.fc35.x86_64/usr/lib/python3.8/site-packages/faker/providers/person/fr_QC/__init__.py:10: UserWarning: fr_QC locale is deprecated. Please use fr_CA.
warnings.warn("fr_QC locale is deprecated. Please use fr_CA.")
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
ERROR tests/providers/test_ssn.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================= 1 warning, 1 error in 10.95s =======================================================================
Issue Analytics
- State:
- Created a year ago
- Comments:15 (2 by maintainers)
Top Results From Across the Web
22.1.0: pytest is failing (circular import in zmq code?) #1550
So here is definitely one issue to solve. buildutils is no longer maintained (last release was 15~ y ago) and it uses distutils...
Read more >pytest fails to import module installed via pip and containing ...
I am used to see import errors of my own modules. But this time, this is about modules installed via pip and located...
Read more >pytest-timeout - PyPI
The pytest-timeout plugin tries to pick the most suitable method based on your platform, but occasionally you may need to specify a specific...
Read more >pytest-2.3.5: bug fixes and little improvements
pytest -2.3.5 is a maintenance release with many bug fixes and little improvements. See the changelog below for details. No backward compatibility issues...
Read more >1653777 – python3-molecule missing dependencies
It works if I install pip-3 pytest but with deprecation warnings: ... to close all bug reports from releases that are no longer...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve created https://github.com/joke2k/faker/issues/1636 to keep track of the efforts re: pakaging
Thank you @stefan6419846. I’ve removed
random2
from the tests