Skip to content

AttributeError: 'Faker' object has no attribute 'generate' #1

@CharlesB2

Description

@CharlesB2

Hi,

Being on Mac M1 I unpinned all requirements versions because some packages weren't able to build on this architecture.
Everything runs fine then, until testing, for which I get the following error:

―――――――――――――――――――――――――――――――― ERROR at setup of TestUserRedirectView.test_get_redirect_url ――――――――――――――――――――――――――――――――

    @pytest.fixture
    def user() -> User:
>       return UserFactory()

everycheese/conftest.py:15:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.8/site-packages/factory/base.py:40: in __call__
    return cls.create(**kwargs)
.venv/lib/python3.8/site-packages/factory/base.py:528: in create
    return cls._generate(enums.CREATE_STRATEGY, kwargs)
.venv/lib/python3.8/site-packages/factory/django.py:117: in _generate
    return super()._generate(strategy, params)
.venv/lib/python3.8/site-packages/factory/base.py:465: in _generate
    return step.build()
.venv/lib/python3.8/site-packages/factory/builder.py:271: in build
    postgen_results[declaration_name] = declaration.declaration.evaluate_post(
.venv/lib/python3.8/site-packages/factory/declarations.py:592: in evaluate_post
    return self.call(instance, step, postgen_context)
.venv/lib/python3.8/site-packages/factory/declarations.py:623: in call
    return self.function(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <User: brownlance>, create = True, extracted = None, kwargs = {}

    @post_generation
    def password(
        self, create: bool, extracted: Sequence[Any], **kwargs
    ):
        password = (
            extracted
            if extracted
>           else Faker(
                "password",
                length=42,
                special_chars=True,
                digits=True,
                upper_case=True,
                lower_case=True,
            ).generate(extra_kwargs={})
E       AttributeError: 'Faker' object has no attribute 'generate'

everycheese/users/tests/factories.py:21: AttributeError

Here's my pip freeze:

appnope==0.1.2
asgiref==3.5.0
astroid==2.9.3
asttokens==2.0.5
attrs==21.4.0
backcall==0.2.0
backports.zoneinfo==0.2.1
black==22.1.0
certifi==2021.10.8
cffi==1.15.0
cfgv==3.3.1
charset-normalizer==2.0.11
click==8.0.3
coverage==6.3
cryptography==36.0.1
decorator==5.1.1
defusedxml==0.7.1
distlib==0.3.4
Django==4.0.1
django-allauth==0.47.0
django-autoslug==1.9.8
django-coverage-plugin==2.0.2
django-crispy-forms==1.14.0
django-debug-toolbar==3.2.4
django-environ==0.8.1
django-extensions==3.1.5
django-model-utils==4.2.0
django-stubs==1.9.0
django-stubs-ext==0.3.1
django-test-plus==2.2.0
executing==0.8.2
factory-boy==3.2.1
Faker==11.3.0
filelock==3.4.2
flake8==4.0.1
identify==2.4.6
idna==3.3
iniconfig==1.1.1
ipdb==0.13.9
ipython==8.0.1
isort==5.10.1
jedi==0.18.1
lazy-object-proxy==1.7.1
matplotlib-inline==0.1.3
mccabe==0.6.1
mypy==0.931
mypy-extensions==0.4.3
nodeenv==1.6.0
oauthlib==3.2.0
packaging==21.3
parso==0.8.3
pathspec==0.9.0
pexpect==4.8.0
pickleshare==0.7.5
Pillow==9.0.0
platformdirs==2.4.1
pluggy==1.0.0
pre-commit==2.17.0
prompt-toolkit==3.0.26
psycopg2-binary==2.9.3
ptyprocess==0.7.0
pure-eval==0.2.2
py==1.11.0
pycodestyle==2.8.0
pycparser==2.21
pyflakes==2.4.0
Pygments==2.11.2
PyJWT==2.3.0
pylint==2.12.2
pylint-django==2.5.0
pylint-plugin-utils==0.7
pyparsing==3.0.7
pytest==6.2.5
pytest-django==4.5.2
pytest-sugar==0.9.4
python-dateutil==2.8.2
python-slugify==5.0.2
python3-openid==3.2.0
pytz==2021.3
PyYAML==6.0
requests==2.27.1
requests-oauthlib==1.3.1
six==1.16.0
sqlparse==0.4.2
stack-data==0.1.4
termcolor==1.1.0
text-unidecode==1.3
toml==0.10.2
tomli==2.0.0
traitlets==5.1.1
types-pytz==2021.3.4
types-PyYAML==6.0.4
typing_extensions==4.0.1
Unidecode==1.3.2
urllib3==1.26.8
virtualenv==20.13.0
wcwidth==0.2.5
Werkzeug==2.0.2
whitenoise==5.3.0
wrapt==1.13.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions