Переглянути джерело

Do not test profiling if the pstats module is not available

Mike Naberezny 11 роки тому
батько
коміт
9b6fa1aa47
1 змінених файлів з 8 додано та 1 видалено
  1. 8 1
      supervisor/tests/test_supervisord.py

+ 8 - 1
supervisor/tests/test_supervisord.py

@@ -15,6 +15,13 @@ from supervisor.tests.base import DummyDispatcher
 
 from supervisor.compat import StringIO
 
+try:
+    import pstats
+except ImportError: # pragma: no cover
+    # Debian-packaged pythons may not have the pstats module
+    # unless the "python-profiler" package is installed.
+    pstats = None
+
 class EntryPointTests(unittest.TestCase):
     def test_main_noprofile(self):
         from supervisor.supervisord import main
@@ -36,7 +43,7 @@ class EntryPointTests(unittest.TestCase):
         output = new_stdout.getvalue()
         self.assertTrue(output.find('supervisord started') != 1, output)
 
-    if sys.version_info[:2] >= (2, 4):
+    if pstats:
         def test_main_profile(self):
             from supervisor.supervisord import main
             conf = os.path.join(