diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2017-02-09 16:08:17 +0100 |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2017-02-09 16:08:17 +0100 |
commit | c6180bb73c8c7c7f9d8ea9816487b710597b6fc1 (patch) | |
tree | fb4a5c18886537b4b7df46ed3b2aa579747ff507 /Lib/test/test_mailbox.py | |
parent | 5e0114a832a903518c4af6983161c0c2a8942a24 (diff) | |
parent | 819a21a3a4aac38f32e1ba4f68bcef45591fa3f0 (diff) | |
download | cpython-c6180bb73c8c7c7f9d8ea9816487b710597b6fc1.tar.gz |
Merge issue #26355 fix from Python 3.5
Diffstat (limited to 'Lib/test/test_mailbox.py')
-rw-r--r-- | Lib/test/test_mailbox.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index 0991f74f84..2ba944335a 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -7,17 +7,12 @@ import email import email.message import re import io -import shutil import tempfile from test import support import unittest import textwrap import mailbox import glob -try: - import fcntl -except ImportError: - pass class TestBase: @@ -2142,9 +2137,9 @@ class MaildirTestCase(unittest.TestCase): if mbox: fp.write(FROM_) fp.write(DUMMY_MESSAGE) - if hasattr(os, "link"): + try: os.link(tmpname, newname) - else: + except (AttributeError, PermissionError): with open(newname, "w") as fp: fp.write(DUMMY_MESSAGE) self._msgfiles.append(newname) @@ -2273,12 +2268,18 @@ Gregory K. Johnson """) +class MiscTestCase(unittest.TestCase): + def test__all__(self): + blacklist = {"linesep", "fcntl"} + support.check__all__(self, mailbox, blacklist=blacklist) + + def test_main(): tests = (TestMailboxSuperclass, TestMaildir, TestMbox, TestMMDF, TestMH, TestBabyl, TestMessage, TestMaildirMessage, TestMboxMessage, TestMHMessage, TestBabylMessage, TestMMDFMessage, TestMessageConversion, TestProxyFile, TestPartialFile, - MaildirTestCase, TestFakeMailBox) + MaildirTestCase, TestFakeMailBox, MiscTestCase) support.run_unittest(*tests) support.reap_children() |