diff options
author | Guido van Rossum <guido@python.org> | 2001-12-07 21:07:08 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-12-07 21:07:08 (GMT) |
commit | 78f0dd3397f77df3b4b3d13c686a33af14a70af8 (patch) | |
tree | f1ee37ed97de9fa1b5a0ac73979c566eb802d09e /Lib | |
parent | 25059d30c39c0c703161987643f0c29df03147fb (diff) | |
download | cpython-78f0dd3397f77df3b4b3d13c686a33af14a70af8.zip cpython-78f0dd3397f77df3b4b3d13c686a33af14a70af8.tar.gz cpython-78f0dd3397f77df3b4b3d13c686a33af14a70af8.tar.bz2 |
I found that when run as a script, this test suite ran its tests
twice! Fixed this by avoiding the import of test_email, which loads
the module a second time in that situation, and fiddled the __main__
section to resemble other test suites using unittest.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_email.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py index 2e7cc00..ddc36f3 100644 --- a/Lib/test/test_email.py +++ b/Lib/test/test_email.py @@ -23,8 +23,7 @@ from email import Errors from email import Encoders from email import Iterators -import test_email -from test_support import findfile +from test_support import findfile, __file__ as test_support_file NL = '\n' @@ -34,7 +33,7 @@ SPACE = ' ' def openfile(filename): - path = os.path.join(os.path.dirname(test_email.__file__), 'data', filename) + path = os.path.join(os.path.dirname(test_support_file), 'data', filename) return open(path) @@ -1041,8 +1040,9 @@ def suite(): -if __name__ == '__main__': - unittest.main(defaultTest='suite') -else: +def test_main(): from test_support import run_suite run_suite(suite()) + +if __name__ == '__main__': + test_main() |