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.
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'
\f
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)
\f
-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()