This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author chris.jerdonek
Recipients chris.jerdonek, michael.foord, r.david.murray, rbcollins, slmnhq
Date 2010-04-09.11:15:08
SpamBayes Score 4.9543377e-07
Marked as misclassified No
Message-id <1270811711.12.0.671670010696.issue7559@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for your suggestions on the test code.  I will do that.

It seems like the hard-coded approach would be more brittle.  For example, if someone wants to replace __import__ with their own, e.g.

old__import__ = __builtins__.__import__

def __my_logging_import(*args, **kwargs):
    print "Importing %s..." % args[0]  # module name
    return old__import__(*args, **kwargs)

__builtins__.__import__ = __my_logging_import

Then the stack traces would be different:

  File "/Users/chris_g4/dev/Python/trunk/Lib/unittest/loader.py", line 92, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "unittests.py", line 8, in __my_logging_import
    return old__import__(*args, **kwargs)
ImportError: No module named sdasfasfasdf

This causes the unit tests not to pass.
History
Date User Action Args
2010-04-09 11:15:11chris.jerdoneksetrecipients: + chris.jerdonek, rbcollins, r.david.murray, michael.foord, slmnhq
2010-04-09 11:15:11chris.jerdoneksetmessageid: <1270811711.12.0.671670010696.issue7559@psf.upfronthosting.co.za>
2010-04-09 11:15:09chris.jerdoneklinkissue7559 messages
2010-04-09 11:15:08chris.jerdonekcreate