Reputation: 1523
I use the django-silk to profile the APIs of my Django project (Django + DRF). Currently, I call APIs in the browser (using DRF browsable API) and then I can see the API profiling data in the silk. When I run the test
command, it doesn't capture requests and responses and therefore it doesn't create any profiling data to show.
Is there a way to force the silk to work in the test environment? My idea is instead of calling APIs one by one in the browser and then checking the silk, only run the tests and then see the profiling data after the tests are finished.
Update
The reason behind this is, the Django uses Transactions in running tests. So after each test function, it rolls back the transaction and data will be deleted from the database.
Upvotes: 2
Views: 277