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

Tests failing since 50d5260 #2137

Closed
mikelolasagasti opened this issue Nov 14, 2024 · 4 comments
Closed

Tests failing since 50d5260 #2137

mikelolasagasti opened this issue Nov 14, 2024 · 4 comments

Comments

@mikelolasagasti
Copy link

  • Faker version: 32.1.0
  • OS: Fedora Rawhide

Since #2117 was merged a few tests are failing:

In GH Actions:

FAILED tests/pytest/test_autouse_faker_locale.py::test_no_injection - assert ...
FAILED tests/pytest/test_autouse_faker_locale.py::test_inject_faker_seed - as...
FAILED tests/pytest/test_autouse_faker_seed.py::test_no_injection - Assertion...
FAILED tests/pytest/test_autouse_faker_seed.py::test_inject_faker_locale - as...
FAILED tests/pytest/test_manual_injection.py::test_no_injection - AssertionEr...
FAILED tests/pytest/test_manual_injection.py::test_inject_faker_locale - asse...
FAILED tests/pytest/test_manual_injection.py::test_inject_faker_seed - Assert...
FAILED tests/pytest/test_manual_injection.py::test_inject_faker_seed_and_locale
FAILED tests/pytest/test_unique_clear.py::test_unique_clears - AssertionError...
FAILED tests/sphinx/test_docstring.py::TestProviderMethodDocstring::test_stringify_results
FAILED tests/test_passport.py::TestEnUS::testDates - assert datetime.date(202...
===== 11 failed, 2035 passed, 10 skipped, 2 warnings in 113.58s (0:01:53) ======

In Fedora:

FAILED tests/pytest/test_autouse_faker_locale.py::test_no_injection - assert ...
FAILED tests/pytest/test_autouse_faker_locale.py::test_inject_faker_seed - as...
FAILED tests/pytest/test_autouse_faker_seed.py::test_no_injection - Assertion...
FAILED tests/pytest/test_autouse_faker_seed.py::test_inject_faker_locale - as...
FAILED tests/pytest/test_manual_injection.py::test_no_injection - AssertionEr...
FAILED tests/pytest/test_manual_injection.py::test_inject_faker_locale - asse...
FAILED tests/pytest/test_manual_injection.py::test_inject_faker_seed - Assert...
FAILED tests/pytest/test_manual_injection.py::test_inject_faker_seed_and_locale
FAILED tests/pytest/test_unique_clear.py::test_unique_clears - AssertionError...
============ 9 failed, 2013 passed, 12 skipped, 1 warning in 40.97s ============

Steps to reproduce

  1. Test 31.0.0 or newer fails
  2. Revert fix(pytest): make fixture session scoped #2117 and works

Issue can be tracked also in GH Actions history: https://github.com/joke2k/faker/actions

@danjac
Copy link

danjac commented Nov 14, 2024

ALL my current tests using the faker fixture now break with this error:

ScopeMismatch: You tried to access the function scoped fixture faker_seed with a session scoped request object

As I was unable to find any other workaround, for now I have added my own fixture which seems to work:

@pytest.fixture
def faker():
    from faker import Faker

    return Faker()

danjac added a commit to danjac/radiofeed-app that referenced this issue Nov 14, 2024
danjac added a commit to danjac/radiofeed-app that referenced this issue Nov 14, 2024
@browniebroke
Copy link
Contributor

In some cases, the problem might stem from other pytest plugins. For example, I'm hitting this because I use pytest-randomly which defines and auto-use its own fake_seed fixture. There is an issue open to track the problem over there:

@fcurella
Copy link
Collaborator

Since this breaks our own tests, I'm going to revert the change

@fcurella
Copy link
Collaborator

Reverted in v33.0.0

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

No branches or pull requests

4 participants