Issue #1234 resolved

Error with Python <2.7

Arfrever Frehtes Taifersar Arahesis
created an issue

CherryPy-3.2.3 introduced 1 call to assertIsInstance() in cherrypy/test/ assertIsInstance() does not exist in Python <2.7.

--- cherrypy/test/
+++ cherrypy/test/
@@ -407,4 +407,4 @@
         sa = cherrypy.lib.cptools.SessionAuth()
         res = sa.login_screen(None, username=unicodestr('nobody'),
-        self.assertIsInstance(res, bytestr)
+        self.assertTrue(isinstance(res, bytestr))

Comments (3)

  1. Jason R. Coombs

    I'm tempted to say rather than force the tests to be backward-compatible, let's require unittest2 for running the tests. Taking a quick look, it seems like this would be a fairly straightforward change to cherrypy/test/

    Any thoughts on whether requiring unittest2 (for tests only) would be too onerous?

  2. Arfrever Frehtes Taifersar Arahesis reporter

    Please do not require/use unittest2 with Python 2.7 or >=3.2, since unittest in these versions is clearly better (bug fixes actively backported etc.) than external unittest2. Last release of unittest2 was about 2.5 years ago.

    I think that requiring unittest2 with Python <=2.6 or 3.1 should be delayed until there is better reason than 1 call to assertIsInstance().

  3. Log in to comment