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
13.3.5: pytest is failing because it uses no longer maintained random2
module
#1635
Comments
Jus tchecked and I've alredy reported that #1454. |
pytest executed with that single file added to ignore list howevert it shows the same warninngs about fr_QC locale as sphinx shows + 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 --ignore tests/providers/test_ssn.py
=========================================================================== 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
tests/test_decode.py ....................................................................................................................................... [ 9%]
tests/test_factory.py ....................... [ 10%]
tests/test_generator.py .................. [ 11%]
tests/test_providers_formats.py ................................................................................. [ 17%]
tests/test_proxy.py ............................ [ 19%]
tests/test_unique.py ..... [ 19%]
tests/providers/__init__.py ............................................ [ 22%]
tests/providers/test_address.py ..........................................................s......................................................................... [ 31%]
.................................................................................................................................................................... [ 42%]
........................ [ 43%]
tests/providers/test_automotive.py ..................................... [ 46%]
tests/providers/test_bank.py .................................................... [ 49%]
tests/providers/test_barcode.py ............................................. [ 52%]
tests/providers/test_color.py ................................. [ 55%]
tests/providers/test_company.py ................................................................ [ 59%]
tests/providers/test_credit_card.py .................. [ 60%]
tests/providers/test_currency.py .................................... [ 62%]
tests/providers/test_date_time.py ........................................................................................... [ 69%]
tests/providers/test_dynamic.py ..... [ 69%]
tests/providers/test_file.py ... [ 69%]
tests/providers/test_geo.py ............................ [ 71%]
tests/providers/test_internet.py ................................................................... [ 75%]
tests/providers/test_isbn.py ...... [ 76%]
tests/providers/test_job.py ............... [ 77%]
tests/providers/test_lorem.py .................................................................... [ 81%]
tests/providers/test_misc.py ........................................... [ 84%]
tests/providers/test_person.py ............................................................... [ 89%]
tests/providers/test_phone_number.py ....................................................... [ 92%]
tests/providers/test_profile.py .. [ 92%]
tests/providers/test_python.py .............s........................................ [ 96%]
tests/providers/test_user_agent.py ... [ 96%]
tests/pytest/test_autouse_faker_locale.py .. [ 96%]
tests/pytest/test_autouse_faker_seed.py .. [ 96%]
tests/pytest/test_manual_injection.py .... [ 97%]
tests/pytest/test_unique_clear.py . [ 97%]
tests/pytest/session_overrides/session_locale/test_autouse_faker_locale.py ss [ 97%]
tests/pytest/session_overrides/session_locale/test_autouse_faker_seed.py ss [ 97%]
tests/pytest/session_overrides/session_locale/test_manual_injection.py ssss [ 97%]
tests/sphinx/test_docstring.py ............ [ 98%]
tests/sphinx/test_validator.py ........... [ 99%]
tests/utils/test_utils.py ......... [100%]
============================================================================= 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
tests/test_factory.py::FactoryTestCase::test_documentor
tests/test_providers_formats.py::test_no_invalid_formats[fr_QC]
/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.")
tests/test_factory.py::FactoryTestCase::test_documentor
/usr/lib/python3.8/site-packages/dateutil/zoneinfo/__init__.py:26: UserWarning: I/O error(2): No such file or directory
warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror))
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/providers/test_address.py:474: could not import 'ukpostcodeparser.parser': No module named 'ukpostcodeparser'
SKIPPED [1] tests/providers/test_python.py:219: Only relevant for Python 3.10 and later.
SKIPPED [2] tests/pytest/session_overrides/session_locale/test_autouse_faker_locale.py: This test is skipped by default since it depends on changes in the behavior of session-scoped fixtures. Use a separate pytest run for tests like this with the "--exclusive-faker-session" flag specified.
SKIPPED [2] tests/pytest/session_overrides/session_locale/test_autouse_faker_seed.py: This test is skipped by default since it depends on changes in the behavior of session-scoped fixtures. Use a separate pytest run for tests like this with the "--exclusive-faker-session" flag specified.
SKIPPED [4] tests/pytest/session_overrides/session_locale/test_manual_injection.py: This test is skipped by default since it depends on changes in the behavior of session-scoped fixtures. Use a separate pytest run for tests like this with the "--exclusive-faker-session" flag specified.
============================================================== 1481 passed, 10 skipped, 4 warnings in 57.89s =============================================================== |
@kloczek would adding |
I'm not using setu.py. As I wrote on top of the ticket I'm using pep517 build procedure. |
If you have the time to work on it, I'll be more than happy to move to |
Issue is that I still have long queue packages to update/do from scratch 😞 .. however you can always count on me to report every possible small issue which I'm able to spot on packaging or test any even preliminary patch in my build env 😃 (best as PR or downloadable over URL patches because it is very easy to plug into my build procedures). |
I've created #1636 to keep track of the efforts re: pakaging |
This issue is stale because it has been open for 30 days with no activity. |
Any progress? 🤔 |
This issue is stale because it has been open for 30 days with no activity. |
Gentle ping .. |
Having a quick look at this, it seems like it is related to the seeds leading to a different behavior for random and random2. Taking self.fake.random = random.Random()
self.fake.seed_instance(0)
print(self.fake.ssn())
self.fake.random = random2.Random()
self.fake.seed_instance(0)
print(self.fake.ssn()) We either have to replace the target value or find the correct seed for random to generate the same strings. As I am not familiar enough with the SSN providers, fixing this myself might lead to wrong results. By the way: When we are already seeding the generator, shouldn't we be able to match the exact result instead? The relevant changes have been #920 by @fcurella and #962 by @darrylwhiting. To fix |
To add on this: I had another look at Nevertheless, as the generated seeds are quite large, I suggest to adapt the tests for the numbers generated with random instead of random2 - maybe doing exact checks for the numbers as well due to using fixed seeds anyway. If there already is some change there, dropping the freezegun decorators inside this test file might be valid as well. |
Thank you @stefan6419846. I've removed |
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
build
with--no-isolation
I'm using during all processes only locally installed modulesExpected behavior
pytest should not fail.
Actual behavior
Here is pytest output:
The text was updated successfully, but these errors were encountered: