diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-03 21:15:46 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-03 21:15:46 (GMT) |
commit | 32e23e739f858fcf47332e437d6c4d4f14b2b697 (patch) | |
tree | 80ed9b1174783a948655f5b47c26b70f135a894d /Lib/test/test_ftplib.py | |
parent | 68f518ce4a700854d3c9b0fef145b9af79883df9 (diff) | |
download | cpython-32e23e739f858fcf47332e437d6c4d4f14b2b697.zip cpython-32e23e739f858fcf47332e437d6c4d4f14b2b697.tar.gz cpython-32e23e739f858fcf47332e437d6c4d4f14b2b697.tar.bz2 |
Issue #18702: All skipped tests now reported as skipped.
Diffstat (limited to 'Lib/test/test_ftplib.py')
-rw-r--r-- | Lib/test/test_ftplib.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index 4060015..15cb336 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -15,7 +15,7 @@ try: except ImportError: ssl = None -from unittest import TestCase +from unittest import TestCase, SkipTest, skipUnless from test import test_support from test.test_support import HOST, HOSTv6 threading = test_support.import_module('threading') @@ -579,8 +579,16 @@ class TestFTPClass(TestCase): self.assertRaises(ftplib.Error, self.client.storlines, 'stor', f) +@skipUnless(socket.has_ipv6, "IPv6 not enabled") class TestIPv6Environment(TestCase): + @classmethod + def setUpClass(cls): + try: + DummyFTPServer((HOST, 0), af=socket.AF_INET6) + except socket.error: + raise SkipTest("IPv6 not enabled") + def setUp(self): self.server = DummyFTPServer((HOSTv6, 0), af=socket.AF_INET6) self.server.start() @@ -615,6 +623,7 @@ class TestIPv6Environment(TestCase): retr() +@skipUnless(ssl, "SSL not available") class TestTLS_FTPClassMixin(TestFTPClass): """Repeat TestFTPClass tests starting the TLS layer for both control and data connections first. @@ -630,6 +639,7 @@ class TestTLS_FTPClassMixin(TestFTPClass): self.client.prot_p() +@skipUnless(ssl, "SSL not available") class TestTLS_FTPClass(TestCase): """Specific TLS_FTP class tests.""" @@ -783,17 +793,9 @@ class TestTimeouts(TestCase): def test_main(): - tests = [TestFTPClass, TestTimeouts] - if socket.has_ipv6: - try: - DummyFTPServer((HOST, 0), af=socket.AF_INET6) - except socket.error: - pass - else: - tests.append(TestIPv6Environment) - - if ssl is not None: - tests.extend([TestTLS_FTPClassMixin, TestTLS_FTPClass]) + tests = [TestFTPClass, TestTimeouts, + TestIPv6Environment, + TestTLS_FTPClassMixin, TestTLS_FTPClass] thread_info = test_support.threading_setup() try: |