[Python-checkins] cpython: Only a few files were opened using findfile; consistently don't use it.

r.david.murray python-checkins at python.org
Thu Mar 31 17:40:53 CEST 2011


http://hg.python.org/cpython/rev/8ff88324c9e9
changeset:   69079:8ff88324c9e9
user:        R David Murray <rdmurray at bitdance.com>
date:        Thu Mar 31 11:40:20 2011 -0400
summary:
  Only a few files were opened using findfile; consistently don't use it.

files:
  Lib/test/test_email/test_email.py |  16 +++++-----------
  1 files changed, 5 insertions(+), 11 deletions(-)


diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -36,7 +36,7 @@
 from email import base64mime
 from email import quoprimime
 
-from test.support import findfile, run_unittest, unlink
+from test.support import run_unittest, unlink
 from test.test_email import __file__ as landmark
 
 
@@ -65,7 +65,7 @@
             raise self.failureException(NL + NL.join(diff))
 
     def _msgobj(self, filename):
-        with openfile(findfile(filename)) as fp:
+        with openfile(filename) as fp:
             return email.message_from_file(fp)
 
 
@@ -194,7 +194,7 @@
     def test_message_rfc822_only(self):
         # Issue 7970: message/rfc822 not in multipart parsed by
         # HeaderParser caused an exception when flattened.
-        with openfile(findfile('msg_46.txt')) as fp:
+        with openfile('msg_46.txt') as fp:
             msgdata = fp.read()
         parser = HeaderParser()
         msg = parser.parsestr(msgdata)
@@ -1055,13 +1055,7 @@
 # Test the basic MIMEAudio class
 class TestMIMEAudio(unittest.TestCase):
     def setUp(self):
-        # Make sure we pick up the audiotest.au that lives in email/test/data.
-        # In Python, there's an audiotest.au living in Lib/test but that isn't
-        # included in some binary distros that don't include the test
-        # package.  The trailing empty string on the .join() is significant
-        # since findfile() will do a dirname().
-        datadir = os.path.join(os.path.dirname(landmark), 'data', '')
-        with open(findfile('audiotest.au', datadir), 'rb') as fp:
+        with openfile('audiotest.au', 'rb') as fp:
             self._audiodata = fp.read()
         self._au = MIMEAudio(self._audiodata)
 
@@ -4320,7 +4314,7 @@
 class TestSigned(TestEmailBase):
 
     def _msg_and_obj(self, filename):
-        with openfile(findfile(filename)) as fp:
+        with openfile(filename) as fp:
             original = fp.read()
             msg = email.message_from_string(original)
         return original, msg

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list