Skip to content

Commit

Permalink
Time setup separately from test
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbrew committed Oct 19, 2020
1 parent 2c5673c commit 1d4c37b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions django_slowtests/testrunner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import glob
import importlib
import json
import time
import os
Expand Down Expand Up @@ -105,9 +106,8 @@ def run(self, result, debug=False):
if result.shouldStop:
break

start_time = _time()

if _isnotsuite(test):
start_time = _time()
self._tearDownPreviousClass(test, result)
self._handleModuleFixture(test, result)
self._handleClassSetUp(test, result)
Expand All @@ -116,6 +116,13 @@ def run(self, result, debug=False):
if (getattr(test.__class__, '_classSetupFailed', False) or
getattr(result, '_moduleSetUpFailed', False)):
continue
self.save_test_time(
f'{test.__class__.__module__}.{test.__class__.__name__}.setUp '
f'({importlib.import_module(test.__class__.__module__).__file__})',
_time() - start_time
)

start_time = _time()

if not debug:
test(result)
Expand Down

0 comments on commit 1d4c37b

Please sign in to comment.