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

django-waffle makes tests implicitly dependent on the order by incosistently resetting the cache #344

Open
vergeev opened this issue Jul 31, 2019 · 0 comments

Comments

@vergeev
Copy link

vergeev commented Jul 31, 2019

Suppose we have two tests which we run with pytest:

def test_1():
    switch11 = Switch.get('switch_name1')
    switch12 = Switch.get('switch_name2')


@override_switch('switch_name1', True)
def test_2():
    switch21 = Switch.get('switch_name1')
    switch22 = Switch.get('switch_name2')

pytest then shuffles the execution order and runs the tests.

  1. Suppose pytest runs test1 first. Then switch21 = Switch.get('switch_name1') will hit the database (as it should per the override_switch doesn't clean the cache making fail tests that use the same switch #309), but switch22 = Switch.get('switch_name2') will not. I would expect that switch22 = Switch.get('switch_name2') will hit the database too.

  2. Suppose pytest runs test2 first. Then both switch21 = Switch.get('switch_name1') and switch22 = Switch.get('switch_name2') will hit the database, as is expected.

Related

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

1 participant