{"action":"created","issue":{"url":"https://api.github.com/repos/realpython/django-slow-tests/issues/12","repository_url":"https://api.github.com/repos/realpython/django-slow-tests","labels_url":"https://api.github.com/repos/realpython/django-slow-tests/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/realpython/django-slow-tests/issues/12/comments","events_url":"https://api.github.com/repos/realpython/django-slow-tests/issues/12/events","html_url":"https://github.com/realpython/django-slow-tests/pull/12","id":192455791,"number":12,"title":"Allow the user to filter slow tests above a threshold","user":{"login":"nickromano","id":70799,"avatar_url":"https://avatars.githubusercontent.com/u/70799?v=3","gravatar_id":"","url":"https://api.github.com/users/nickromano","html_url":"https://github.com/nickromano","followers_url":"https://api.github.com/users/nickromano/followers","following_url":"https://api.github.com/users/nickromano/following{/other_user}","gists_url":"https://api.github.com/users/nickromano/gists{/gist_id}","starred_url":"https://api.github.com/users/nickromano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickromano/subscriptions","organizations_url":"https://api.github.com/users/nickromano/orgs","repos_url":"https://api.github.com/users/nickromano/repos","events_url":"https://api.github.com/users/nickromano/events{/privacy}","received_events_url":"https://api.github.com/users/nickromano/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-30T02:05:53Z","updated_at":"2016-11-30T02:39:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/realpython/django-slow-tests/pulls/12","html_url":"https://github.com/realpython/django-slow-tests/pull/12","diff_url":"https://github.com/realpython/django-slow-tests/pull/12.diff","patch_url":"https://github.com/realpython/django-slow-tests/pull/12.patch"},"body":"I have added an option to allow a user to specify a threshold so only tests slower than `SLOW_TEST_THRESHOLD_MS` will be shown.\r\n\r\nWithout specifying the setting the slowest tests will always show as expected.\r\n\r\n```\r\n$ python manage.py test\r\nCreating test database for alias 'default'...\r\n..........\r\n----------------------------------------------------------------------\r\nRan 10 tests in 0.413s\r\n\r\nOK\r\nDestroying test database for alias 'default'...\r\n\r\n10 slowest tests:\r\n0.3597s test_detail_view_with_a_future_poll (polls.tests.PollIndexDetailTests)\r\n0.2843s test_detail_view_with_a_past_poll (polls.tests.PollIndexDetailTests)\r\n0.0068s test_index_view_with_a_future_poll (polls.tests.PollViewTests)\r\n0.0047s test_index_view_with_a_past_poll (polls.tests.PollViewTests)\r\n0.0045s test_index_view_with_two_past_polls (polls.tests.PollViewTests)\r\n0.0041s test_index_view_with_future_poll_and_past_poll (polls.tests.PollViewTests)\r\n0.0036s test_index_view_with_no_polls (polls.tests.PollViewTests)\r\n0.0003s test_was_published_recently_with_future_poll (polls.tests.PollMethodTests)\r\n0.0002s test_was_published_recently_with_recent_poll (polls.tests.PollMethodTests)\r\n0.0002s test_was_published_recently_with_old_poll (polls.tests.PollMethodTests)\r\n```\r\n\r\nBut if you have the option to specify for example `SLOW_TEST_THRESHOLD_MS = 200` then only tests slower than this limit will show:\r\n\r\n```\r\n$ python manage.py test\r\nCreating test database for alias 'default'...\r\n..........\r\n----------------------------------------------------------------------\r\nRan 10 tests in 0.413s\r\n\r\nOK\r\nDestroying test database for alias 'default'...\r\n\r\n2 slowest tests over 200ms:\r\n0.3597s test_detail_view_with_a_future_poll (polls.tests.PollIndexDetailTests)\r\n0.2843s test_detail_view_with_a_past_poll (polls.tests.PollIndexDetailTests)\r\n```\r\n\r\nAnd if there are no tests above the threshold you will see the following message (for example if `SLOW_TEST_THRESHOLD_MS` is set to `400`):\r\n\r\n```\r\n$ python manage.py test\r\nCreating test database for alias 'default'...\r\n..........\r\n----------------------------------------------------------------------\r\nRan 10 tests in 0.413s\r\n\r\nOK\r\nDestroying test database for alias 'default'...\r\n\r\nNo tests slower than 400ms\r\n```\r\n\r\nPlease let me know if you have any questions!\r\n\r\nThank you,\r\nNick"},"comment":{"url":"https://api.github.com/repos/realpython/django-slow-tests/issues/comments/263766362","html_url":"https://github.com/realpython/django-slow-tests/pull/12#issuecomment-263766362","issue_url":"https://api.github.com/repos/realpython/django-slow-tests/issues/12","id":263766362,"user":{"login":"nickromano","id":70799,"avatar_url":"https://avatars.githubusercontent.com/u/70799?v=3","gravatar_id":"","url":"https://api.github.com/users/nickromano","html_url":"https://github.com/nickromano","followers_url":"https://api.github.com/users/nickromano/followers","following_url":"https://api.github.com/users/nickromano/following{/other_user}","gists_url":"https://api.github.com/users/nickromano/gists{/gist_id}","starred_url":"https://api.github.com/users/nickromano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickromano/subscriptions","organizations_url":"https://api.github.com/users/nickromano/orgs","repos_url":"https://api.github.com/users/nickromano/repos","events_url":"https://api.github.com/users/nickromano/events{/privacy}","received_events_url":"https://api.github.com/users/nickromano/received_events","type":"User","site_admin":false},"created_at":"2016-11-30T02:39:28Z","updated_at":"2016-11-30T02:39:28Z","body":"If anyone has an idea of how to run and check the `teardown_test_environment` method in `django_slowtests.tests.tests` please let me know!\r\n\r\nI'd be happy to write test cases for it."}}
{"actor":{"display_login":"nickromano"}}