Explorar el Código

Also fragrant is the smell of attempting to remain compatible with four-year-old Python versions.

Chris McDonough hace 18 años
padre
commit
06263f44ea
Se han modificado 2 ficheros con 17 adiciones y 0 borrados
  1. 4 0
      CHANGES.txt
  2. 13 0
      src/supervisor/tests/__init__.py

+ 4 - 0
CHANGES.txt

@@ -49,6 +49,10 @@
     which respects this envvar and does not try to compile its optional
     C extensions when it's set).
 
+  - The test suite would fail on Python versions <= 2.3.3 because
+    the "assertTrue" and "assertFalse" methods of unittest.TestCase
+    didn't exist in those versions.
+
 3.0a1
 
   - Default config file comment documented 10 secs as default for

+ 13 - 0
src/supervisor/tests/__init__.py

@@ -1 +1,14 @@
 # this is a package
+from unittest import TestCase
+def assertTrue(self, value, extra=None):
+    if not value:
+        raise AssertionError(extra)
+def assertFalse(self, value, extra=None):
+    if value:
+        raise AssertionError(extra)
+
+if not hasattr(TestCase, 'assertTrue'): # Python 2.3.3
+    TestCase.assertTrue = assertTrue
+
+if not hasattr(TestCase, 'assertFalse'): # Pytthon 2.3.3
+    TestCase.assertFalse = assertFalse