[Python-Dev] Python equivalents in stdlib Was: Include datetime.py in stdlib or not? (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Thu Jul 8 23:46:48 CEST 2010


On Fri, Jul 9, 2010 at 5:24 AM, Alexander Belopolsky <alexander.belopolsky at gmail.com> wrote:

Yes, this is definitely an improvement over my current datetime patch [1], but it still requires a custom testmain() and does not make the test cases discoverable by alternative unittest runners.  I think that can be fixed by injecting imported TestCase subclasses into the main test module globals.

So include something along the lines of "globals()[obj.name] = obj" in the name hacking loop to make the test classes more discoverable? Good idea.

Including a comment in the main test module along the lines of your reply to Antoine would be good, too (i.e. this is acknowledged as being something of a hack to make sure we don't break the datetime tests when updating them to be applied to both the existing C module and the new pure Python equivalent). As Antoine says, using explicit subclasses is a much cleaner way of doing this kind of thing when the tests are being written from scratch to test multiple implementations within a single interpreter.

Cheers, Nick.

-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia



More information about the Python-Dev mailing list