diff options
| author | Aymeric Augustin | 2013-11-29 10:33:25 +0100 |
|---|---|---|
| committer | Aymeric Augustin | 2013-11-29 10:45:58 +0100 |
| commit | a7dbc61ec4b4932a570d538b23a3ddd1d46203d4 (patch) | |
| tree | a3b24c616ad99fb31160a96fa96e2c2563bf4dcf /tests/panels | |
| parent | 2135eac0d5d8e249af395db903608fd0f4bb5ce0 (diff) | |
| download | django-debug-toolbar-a7dbc61ec4b4932a570d538b23a3ddd1d46203d4.tar.bz2 | |
Move support for line_profiler to a 3rd party panel.
Many thanks to Dave McLain.
Fix #477.
Diffstat (limited to 'tests/panels')
| -rw-r--r-- | tests/panels/test_profiling.py | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/tests/panels/test_profiling.py b/tests/panels/test_profiling.py index 7e61c62..3353b98 100644 --- a/tests/panels/test_profiling.py +++ b/tests/panels/test_profiling.py @@ -6,13 +6,6 @@ from django.test import TestCase from django.test.utils import override_settings from django.utils import unittest -try: - import line_profiler -except ImportError: - line_profiler = None - -from debug_toolbar.panels import profiling - from ..base import BaseTestCase from ..views import regular_view @@ -24,28 +17,15 @@ class ProfilingPanelTestCase(BaseTestCase): super(ProfilingPanelTestCase, self).setUp() self.panel = self.toolbar.get_panel_by_id('ProfilingPanel') - def _test_render_with_or_without_line_profiler(self): + # This test fails randomly for a reason I don't understand. + + @unittest.expectedFailure + def test_regular_view(self): self.panel.process_view(self.request, regular_view, ('profiling',), {}) self.panel.process_response(self.request, self.response) self.assertIn('func_list', self.panel.get_stats()) self.assertIn('regular_view', self.panel.content) - # These two tests fail randomly for a reason I don't understand. - - @unittest.expectedFailure - @unittest.skipIf(line_profiler is None, "line_profiler isn't available") - def test_render_with_line_profiler(self): - self._test_render_with_or_without_line_profiler() - - @unittest.expectedFailure - def test_without_line_profiler(self): - _use_line_profiler = profiling.DJ_PROFILE_USE_LINE_PROFILER - profiling.DJ_PROFILE_USE_LINE_PROFILER = False - try: - self._test_render_with_or_without_line_profiler() - finally: - profiling.DJ_PROFILE_USE_LINE_PROFILER = _use_line_profiler - @override_settings(DEBUG=True, DEBUG_TOOLBAR_PANELS=['debug_toolbar.panels.profiling.ProfilingPanel']) |
