[Python-Dev] Re: [Python-checkins] python/dist/src/Lib/email/test test_email_codecs.py,1.1,1.2

Barry A. Warsaw barry@zope.com
Mon, 22 Jul 2002 13:24:52 -0400


[Diverting to python-dev... -BAW]

    timmie> Update of /cvsroot/python/python/dist/src/Lib/email/test
    timmie> In directory
    timmie> usw-pr-cvs1:/tmp/cvs-serv3289/python/lib/email/test

    | Modified Files:
    | 	test_email_codecs.py 
    | Log Message:
    | Changed import from
    |     from test.test_support import TestSkipped, run_unittest
    | to
    |     from test_support import TestSkipped, run_unittest

    timmie> Otherwise, if the Japanese codecs aren't installed,
    timmie> regrtest doesn't believe the TestSkipped exception raised
    timmie> by this test matches the

    timmie>     except (ImportError, test_support.TestSkipped), msg:

    timmie> it's looking for, and reports the skip as a crash failure
    timmie> instead of as a skipped test.

    timmie> I suppose this will make it harder to run this test
    timmie> outside of regrtest, but under the assumption only Barry
    timmie> does that, better to make it skip cleanly for everyone
    timmie> else.

A better fix, IMO, is to recognize that the `test' package has become
a full fledged standard lib package (a Good Thing, IMO), heed our own
admonitions not to do relative imports, and change the various places
in the test suite that "import test_support" (or equiv) to "import
test.test_support" (or equiv).

I've twiddled the test suite to do things this way, and all the
(expected Linux) tests pass, so I'd like to commit these changes.
Unit test writers need to remember to use test.test_support instead of
just test_support.  We could do something wacky like remove '' from
sys.path if we really cared about enforcing this.  It would also be
good for folks on other systems to make sure I haven't missed a
module.

-Barry