소스 검색

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(