joke2k / faker

Faker is a Python package that generates fake data for you.
https://faker.readthedocs.io
MIT License
17.59k stars 1.92k forks source link

19.8.0: pytest is failing in two units #1923

Closed kloczek closed 11 months ago

kloczek commented 11 months ago

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.

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-faker-19.8.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-faker-19.8.0-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' -q ============================= test session starts ============================== platform linux -- Python 3.8.18, pytest-7.4.2, pluggy-1.3.0 rootdir: /home/tkloczko/rpmbuild/BUILD/faker-19.8.0 configfile: setup.cfg plugins: Faker-19.8.0 collected 1837 items tests/test_decode.py ................................................... [ 2%] ........................................................................ [ 6%] ............ [ 7%] tests/test_factory.py ....................... [ 8%] tests/test_generator.py .................. [ 9%] tests/test_optional.py ..... [ 9%] tests/test_passport.py ...... [ 10%] tests/test_providers_formats.py ........................................ [ 12%] ................................................. [ 15%] tests/test_proxy.py ............................ [ 16%] tests/test_unique.py ..... [ 16%] tests/providers/__init__.py ............................................ [ 19%] . [ 19%] tests/providers/test_address.py ........................................ [ 21%] ...........................s............................................ [ 25%] ........................................................................ [ 29%] ........................................................................ [ 33%] ........................................................................ [ 37%] .............. [ 37%] tests/providers/test_automotive.py ..................................... [ 39%] ...................................... [ 41%] tests/providers/test_bank.py ........................................... [ 44%] ........................... [ 45%] tests/providers/test_barcode.py ........................................ [ 47%] ..... [ 48%] tests/providers/test_color.py .......................................... [ 50%] . [ 50%] tests/providers/test_company.py ........................................ [ 52%] ........................... [ 54%] tests/providers/test_credit_card.py .................. [ 55%] tests/providers/test_currency.py ...................................... [ 57%] tests/providers/test_date_time.py ...................................... [ 59%] ...................................................................... [ 63%] tests/providers/test_dynamic.py ....... [ 63%] tests/providers/test_emoji.py . [ 63%] tests/providers/test_enum.py ..... [ 63%] tests/providers/test_file.py ... [ 64%] tests/providers/test_geo.py ............................ [ 65%] tests/providers/test_internet.py ....................................... [ 67%] ................................... [ 69%] tests/providers/test_isbn.py ...... [ 69%] tests/providers/test_job.py ................ [ 70%] tests/providers/test_lorem.py .......................................... [ 73%] ......................................... [ 75%] tests/providers/test_misc.py ..............s.......s.................... [ 77%] ..... [ 77%] tests/providers/test_person.py .......FF................................ [ 80%] ................................... [ 82%] tests/providers/test_phone_number.py ................................... [ 83%] ..................... [ 85%] tests/providers/test_profile.py .. [ 85%] tests/providers/test_python.py ..........................s.............. [ 87%] .............................................. [ 89%] tests/providers/test_sbn.py .... [ 90%] tests/providers/test_ssn.py ............................................ [ 92%] ........................................................................ [ 96%] ............ [ 97%] tests/providers/test_user_agent.py .... [ 97%] tests/pytest/test_autouse_faker_locale.py .. [ 97%] tests/pytest/test_autouse_faker_seed.py .. [ 97%] 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 s [ 97%] s [ 97%] tests/pytest/session_overrides/session_locale/test_autouse_faker_seed.py s [ 97%] s [ 98%] tests/pytest/session_overrides/session_locale/test_manual_injection.py s [ 98%] sss [ 98%] tests/sphinx/test_docstring.py ............ [ 98%] tests/sphinx/test_validator.py ........... [ 99%] tests/utils/test_utils.py ......... [100%] =================================== FAILURES =================================== ___________________________ TestLvLV.test_first_name ___________________________ self = def test_first_name(self): # General first name name = self.fake.first_name() assert name self.assertIsInstance(name, str) > assert name in LvProvider.provider.first_names E AttributeError: type object 'Provider' has no attribute 'provider' tests/providers/test_person.py:302: AttributeError ___________________________ TestLvLV.test_last_name ____________________________ self = def test_last_name(self): # General last name. name = self.fake.last_name() assert name self.assertIsInstance(name, str) assert name in LvProvider.last_names # Females last name. name = self.fake.last_name_female() assert name self.assertIsInstance(name, str) assert name in LvProvider.last_names_female + LvProvider.last_names_unisex # Females only last name. > name = self.fake.last_name_unique_to_female() tests/providers/test_person.py:332: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = attr = 'last_name_unique_to_female' def __getattr__(self, attr: str) -> Any: """ Handles cache access and proxying behavior :param attr: attribute name :return: the appropriate attribute """ if len(self._factories) == 1: > return getattr(self._factories[0], attr) E AttributeError: 'Generator' object has no attribute 'last_name_unique_to_female' ../../BUILDROOT/python-faker-19.8.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/faker/proxy.py:114: AttributeError =============================== warnings summary =============================== ../../BUILDROOT/python-faker-19.8.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/faker/providers/person/fr_QC/__init__.py:10 tests/test_providers_formats.py::test_no_invalid_formats[fr_QC] /home/tkloczko/rpmbuild/BUILDROOT/python-faker-19.8.0-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 ============================ SKIPPED [1] tests/providers/test_address.py:531: could not import 'ukpostcodeparser.parser': No module named 'ukpostcodeparser' SKIPPED [1] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:371: requires the Python Image Library SKIPPED [1] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:371: requires the Python xmltodict Library SKIPPED [1] tests/providers/test_python.py:282: 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. FAILED tests/providers/test_person.py::TestLvLV::test_first_name - AttributeE... FAILED tests/providers/test_person.py::TestLvLV::test_last_name - AttributeEr... ====== 2 failed, 1823 passed, 12 skipped, 2 warnings in 65.49s (0:01:05) ======= ```

Here is list of installed modules in build env

```console Package Version ----------------------------- ------- alabaster 0.7.13 Babel 2.13.0 build 1.0.0 charset-normalizer 3.3.0 distro 1.8.0 docutils 0.20.1 exceptiongroup 1.1.3 freezegun 1.2.2 gpg 1.21.0 idna 3.4 imagesize 1.4.1 importlib-metadata 6.8.0 iniconfig 2.0.0 installer 0.7.0 Jinja2 3.1.2 libcomps 0.1.19 MarkupSafe 2.1.3 packaging 23.2 pkg 0.0.0 pluggy 1.3.0 Pygments 2.16.1 pyproject_hooks 1.0.0 pytest 7.4.2 python-dateutil 2.8.2 pytz 2023.3 requests 2.31.0 setuptools 68.2.2 six 1.16.0 snowballstemmer 2.2.0 Sphinx 7.1.2 sphinxcontrib-applehelp 1.0.4 sphinxcontrib-devhelp 1.0.2 sphinxcontrib-htmlhelp 2.0.3 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.9 text-unidecode 1.3 tomli 2.0.1 urllib3 1.26.17 validators 0.22.0 wheel 0.41.1 zipp 3.17.0 ```
mtelka commented 11 months ago

TestLvLV fails at OpenIndiana too.

stefan6419846 commented 11 months ago

They fail on the official CI as well: https://github.com/joke2k/faker/actions/runs/6458736515/job/17533291094

fcurella commented 11 months ago

Sorry about that! Fixed in 823a806