jazzband / django-waffle

A feature flipper for Django
https://waffle.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.13k stars 258 forks source link

Enable pytest support for django waffle #453

Open rievva-aleksandra opened 2 years ago

rievva-aleksandra commented 2 years ago

It would be very useful if testing utils such as override_switch and override_flag were available for pytest style classes as class decorators. Is this feature somewhere on the road map?

clintonb commented 2 years ago

Those already exist. See https://waffle.readthedocs.io/en/stable/testing/automated.html#testing-automated.

rievva-aleksandra commented 2 years ago

right now if you try to write this like this

@override_switch("some_switch", active=True)
class TestFoo:
    ...

it fails with TypeError: Can only decorate subclasses of unittest.TestCase. on the latest 2.6.0 version, sorry for not making it clear right away.

clintonb commented 2 years ago

You’re welcome to submit a pull request adding a pytest decorator.