You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The test examples in the README favor class-based over function-based tests. Clearly, you're inheriting from DRF test classes and go from there.
Is this a concious choice or more of a compromise?
I prefer writing test code function-based with Pytest to reduce visual clutter, so I try to understand whether it's possible to do that with pytest-drf. If it is not, currently is it feasible to adapt the implementation in a way that it would be?
The text was updated successfully, but these errors were encountered:
Could you show me an example of the same test written in both class-based and function-based form? I don't think I understand the difference between the two.
Though, to be clear, pytest-drf is fixture-based, and classes are the only sensible way to package up a set of fixtures without polluting all tests in the session (as one of the fixtures is, critically, an autouse fixture). I suppose a pytest library could provide a submodule to be imported like from pytest_drf.module_scoped import *, so tests could be written at module-level – but all assertion-rewriting would be missed, so we'd have to invoke that manually ourselves, somehow.
The test examples in the README favor class-based over function-based tests. Clearly, you're inheriting from DRF test classes and go from there.
Is this a concious choice or more of a compromise?
I prefer writing test code function-based with Pytest to reduce visual clutter, so I try to understand whether it's possible to do that with
pytest-drf
. If it is not, currently is it feasible to adapt the implementation in a way that it would be?The text was updated successfully, but these errors were encountered: