Django: is there a way to count SQL queries from an unit test?

前端 未结 8 920
广开言路
广开言路 2021-01-31 13:55

I am trying to find out the number of queries executed by a utility function. I have written a unit test for this function and the function is working well. What I would like to

8条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-31 14:32

    Since Django 1.3 there is a assertNumQueries available exactly for this purpose.

提交回复
热议问题