r46844 - failing tests

hawkowl-TA+aISz0psMTMxyoc4vAAJOcrHinNvQL0E9HWUfgJXw@public.gmane.org
Newsgroups gmane.comp.python.twisted.commits
Message-ID <[email protected]>
Author: hawkowl
Date: Wed Feb 24 18:40:51 2016
New Revision: 46844

Modified:
   branches/old-versionpy-8219/twisted/test/test_twisted.py

Log:
failing tests

Modified: branches/old-versionpy-8219/twisted/test/test_twisted.py
==============================================================================
--- branches/old-versionpy-8219/twisted/test/test_twisted.py	(original)
+++ branches/old-versionpy-8219/twisted/test/test_twisted.py	Wed Feb 24 18:40:51 2016
@@ -9,10 +9,13 @@
 from __future__ import division, absolute_import
 
 import sys
+import twisted
+
 from types import ModuleType, FunctionType
 
 from twisted import _checkRequirements
 from twisted.python.compat import _PY3
+from twisted.python import reflect
 from twisted.trial.unittest import TestCase, SkipTest
 
 
@@ -634,3 +637,58 @@
                 pass
             else:
                 raise SkipTest("Mismatched system version of zope.interface")
+
+
+
+class OldSubprojectDeprecationBase(TestCase):
+
+    subproject = None
+
+    def test_deprecated(self):
+        """
+        The C{__version__} attribute of former subprojects is deprecated.
+        """
+        module = reflect.namedAny("twisted.{}".format(self.subproject))
+        self.assertEqual(module.__version__, twisted.__version__)
+
+        warningsShown = self.flushWarnings()
+        self.assertEqual(1, len(warningsShown))
+        self.assertEqual(
+            "twisted.{}.__version__ was deprecated in Twisted 16.0.0: "
+            "Use twisted.__version__ instead.".format(self.subproject),
+            warningsShown[0]['message'])
+
+
+    def test_noversionpy(self):
+        """
+        Former subprojects no longer have an importable C{_version.py}.
+        """
+        with self.assertRaises(AttributeError) as e:
+            module = reflect.namedAny(
+                "twisted.{}._version".format(self.subproject))
+
+
+
+
+subprojects = ["mail", "conch", "runner", "web", "words", "names", "news",
+               "pair"]
+
+for subproject in subprojects:
+
+    class SubprojectTestCase(OldSubprojectDeprecationBase):
+        subproject = subproject
+
+    newName = subproject.title() + "VersionDeprecationTests"
+
+    SubprojectTestCase.__name__ = newName
+    SubprojectTestCase.__qualname__= ".".join(
+        OldSubprojectDeprecationBase.__qualname__.split()[0:-1] +
+        [newName])
+
+    globals().update({subproject.title() +
+                      "VersionDeprecationTests": SubprojectTestCase})
+
+    del SubprojectTestCase
+    del newName
+
+del OldSubprojectDeprecationBase
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.