pytest-django-queries icon indicating copy to clipboard operation
pytest-django-queries copied to clipboard

Add an option for counting queries on all tests

Open NyanKiyoshi opened this issue 6 years ago • 2 comments

Is your feature request related to a problem? Please describe. Some users might want to count queries on all their tests without implementing new test cases for checks. So we could include an option for that.

Describe the solution you'd like We could put a option --queries-count-all or such.

Describe alternatives you've considered None.

Additional context None.

NyanKiyoshi avatar Jun 02 '19 19:06 NyanKiyoshi

Hi @NyanKiyoshi , I'm interested on this feature. Can I help? Do you have planned something?

fgmacedo avatar Feb 25 '21 17:02 fgmacedo

Hey, sure you can help if you have time to do so!

I would assume the flow could be something like so:

  1. Add a new option in https://github.com/NyanKiyoshi/pytest-django-queries/blob/9c2f87106cb8f2a86b6b2bfca19dbe5f9696984b/pytest_django_queries/plugin.py#L77-L95 (dest could be count_all_tests)
  2. Then in that fixture we could do a check whether request.config.count_all_tests is set to True: https://github.com/NyanKiyoshi/pytest-django-queries/blob/9c2f87106cb8f2a86b6b2bfca19dbe5f9696984b/pytest_django_queries/plugin.py#L128-L141

NyanKiyoshi avatar Feb 26 '21 06:02 NyanKiyoshi