DRF adds an APIClient class extending django's Client class. Since I'm using DRF and pytest to test it an api_client fixture seems appropriate. Is this something you're willing to consider?
I think an api_client fixture would be a good idea. However, I would like to have this plugin stay as close to Django as possible and provide hooks when necessary to work with other Django apps when needed.
In this case, just providing fixtures can be done by any plugin. django-rest-framework itself could be a pytest plugin that provides general purpose DRF fixtures. DRF uses pytest-django for its own test suite and may be happy to also provide user fixtures as a plugin.
Celery uses this same approach. Installing celery also installs celery as a pytest plugin:
http://docs.celeryproject.org/en/latest/userguide/testing.html#fixtures
https://github.com/celery/celery/blob/9ce1b1bf656ca5cc856067c1e21b2de243f0fa28/setup.py#L224-L226
Please open an issue in django-rest-framework and propose this and ping me in that issue if you need any help!
If DRF is not interested in this, it should be pretty straightforward to create pytest-django-rest-framework or something like that (see https://github.com/pytest-dev/cookiecutter-pytest-plugin).
Celery uses this same approach. Installing celery also installs celery as a pytest plugin
Nice! Should be noted however that this is only available with celery 4.0+.
Most helpful comment
I think an api_client fixture would be a good idea. However, I would like to have this plugin stay as close to Django as possible and provide hooks when necessary to work with other Django apps when needed.
In this case, just providing fixtures can be done by any plugin. django-rest-framework itself could be a pytest plugin that provides general purpose DRF fixtures. DRF uses pytest-django for its own test suite and may be happy to also provide user fixtures as a plugin.
Celery uses this same approach. Installing celery also installs celery as a pytest plugin:
http://docs.celeryproject.org/en/latest/userguide/testing.html#fixtures
https://github.com/celery/celery/blob/9ce1b1bf656ca5cc856067c1e21b2de243f0fa28/setup.py#L224-L226
Please open an issue in django-rest-framework and propose this and ping me in that issue if you need any help!
If DRF is not interested in this, it should be pretty straightforward to create pytest-django-rest-framework or something like that (see https://github.com/pytest-dev/cookiecutter-pytest-plugin).