Antoine Pitrou <pit...@free.fr> added the comment:

Hi,

> I don't think the decorator approach would work for the doctests, it looks 
> like it could be an interesting approach though. I have a feeling that 
> it's going to have to be done in some kind of ugly subclass though, I'll 
> dig into unittest deeper this weekend to see how that might be done.

Doctests will be annoying indeed. I never use doctests so I can't
suggest you anything.
As for standard unit tests, the common idiom is something like:

class JSONEncodingTests:
    def test_encode1(self):
        self.assertEquals(self.encode("foo"), "bar")
    # etc.

class CJSONEncodingTests(JSONEncodingTests, unittest.TestCase):
    encode = json.c_encode

class PyJSONEncodingTests(JSONEncodingTests, unittest.TestCase):
    encode = json.py_encode

(I'm CC'ing you since bugs.python.org looks down)

Regards

Antoine.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5723>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to