summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email/test_email.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2011-03-31 16:20:23 (GMT)
committerR David Murray <rdmurray@bitdance.com>2011-03-31 16:20:23 (GMT)
commita256bacf918d0c242ad29ce6d3f9b4a507b47609 (patch)
treec512eff52bf313b6821906039f9a35af94213ec8 /Lib/test/test_email/test_email.py
parent19402331022fa73a93fe6b82617ba1dd84d67557 (diff)
downloadcpython-a256bacf918d0c242ad29ce6d3f9b4a507b47609.zip
cpython-a256bacf918d0c242ad29ce6d3f9b4a507b47609.tar.gz
cpython-a256bacf918d0c242ad29ce6d3f9b4a507b47609.tar.bz2
Move infrastructure into __init__ to lay groundwork for splitting test_email.
The split probably won't happen for a while, but I might as well lay the groundwork now since I'll be adding new test modules before too long.
Diffstat (limited to 'Lib/test/test_email/test_email.py')
-rw-r--r--Lib/test/test_email/test_email.py28
1 files changed, 1 insertions, 27 deletions
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
index 2735666..2519cc0 100644
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -37,39 +37,13 @@ from email import base64mime
from email import quoprimime
from test.support import run_unittest, unlink
-from test.test_email import __file__ as landmark
-
+from test.test_email import openfile, TestEmailBase
NL = '\n'
EMPTYSTRING = ''
SPACE = ' '
-
-def openfile(filename, *args, **kws):
- path = os.path.join(os.path.dirname(landmark), 'data', filename)
- return open(path, *args, **kws)
-
-
-
-# Base test class
-class TestEmailBase(unittest.TestCase):
- def ndiffAssertEqual(self, first, second):
- """Like assertEqual except use ndiff for readable output."""
- if first != second:
- sfirst = str(first)
- ssecond = str(second)
- rfirst = [repr(line) for line in sfirst.splitlines()]
- rsecond = [repr(line) for line in ssecond.splitlines()]
- diff = difflib.ndiff(rfirst, rsecond)
- raise self.failureException(NL + NL.join(diff))
-
- def _msgobj(self, filename):
- with openfile(filename) as fp:
- return email.message_from_file(fp)
-
-
-
# Test various aspects of the Message class's API
class TestMessageAPI(TestEmailBase):
def test_get_all(self):