Skip to content

Commit aeca8a4

Browse files
alexreaperhulk
authored andcommitted
Remove tests of long functionality (#832)
These don't actually cover any code.
1 parent 1fbe064 commit aeca8a4

File tree

1 file changed

+0
-117
lines changed

1 file changed

+0
-117
lines changed

tests/test_ssl.py

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -530,13 +530,6 @@ def test_method(self):
530530
with pytest.raises(ValueError):
531531
Context(10)
532532

533-
@skip_if_py3
534-
def test_method_long(self):
535-
"""
536-
On Python 2 `Context` accepts values of type `long` as well as `int`.
537-
"""
538-
Context(long(TLSv1_METHOD))
539-
540533
def test_type(self):
541534
"""
542535
`Context` can be used to create instances of that type.
@@ -609,14 +602,6 @@ def test_use_privatekey_file_unicode(self, tmpfile):
609602
FILETYPE_PEM,
610603
)
611604

612-
@skip_if_py3
613-
def test_use_privatekey_file_long(self, tmpfile):
614-
"""
615-
On Python 2 `Context.use_privatekey_file` accepts a filetype of
616-
type `long` as well as `int`.
617-
"""
618-
self._use_privatekey_file_test(tmpfile, long(FILETYPE_PEM))
619-
620605
def test_use_certificate_wrong_args(self):
621606
"""
622607
`Context.use_certificate_wrong_args` raises `TypeError` when not passed
@@ -705,19 +690,6 @@ def test_use_certificate_file_unicode(self, tmpfile):
705690
filename = tmpfile.decode(getfilesystemencoding()) + NON_ASCII
706691
self._use_certificate_file_test(filename)
707692

708-
@skip_if_py3
709-
def test_use_certificate_file_long(self, tmpfile):
710-
"""
711-
On Python 2 `Context.use_certificate_file` accepts a
712-
filetype of type `long` as well as `int`.
713-
"""
714-
pem_filename = tmpfile
715-
with open(pem_filename, "wb") as pem_file:
716-
pem_file.write(cleartextCertificatePEM)
717-
718-
ctx = Context(TLSv1_METHOD)
719-
ctx.use_certificate_file(pem_filename, long(FILETYPE_PEM))
720-
721693
def test_check_privatekey_valid(self):
722694
"""
723695
`Context.check_privatekey` returns `None` if the `Context` instance
@@ -771,16 +743,6 @@ def test_set_options(self):
771743
options = context.set_options(OP_NO_SSLv2)
772744
assert options & OP_NO_SSLv2 == OP_NO_SSLv2
773745

774-
@skip_if_py3
775-
def test_set_options_long(self):
776-
"""
777-
On Python 2 `Context.set_options` accepts values of type
778-
`long` as well as `int`.
779-
"""
780-
context = Context(TLSv1_METHOD)
781-
options = context.set_options(long(OP_NO_SSLv2))
782-
assert options & OP_NO_SSLv2 == OP_NO_SSLv2
783-
784746
def test_set_mode_wrong_args(self):
785747
"""
786748
`Context.set_mode` raises `TypeError` if called with
@@ -798,16 +760,6 @@ def test_set_mode(self):
798760
context = Context(TLSv1_METHOD)
799761
assert MODE_RELEASE_BUFFERS & context.set_mode(MODE_RELEASE_BUFFERS)
800762

801-
@skip_if_py3
802-
def test_set_mode_long(self):
803-
"""
804-
On Python 2 `Context.set_mode` accepts values of type `long` as well
805-
as `int`.
806-
"""
807-
context = Context(TLSv1_METHOD)
808-
mode = context.set_mode(long(MODE_RELEASE_BUFFERS))
809-
assert MODE_RELEASE_BUFFERS & mode
810-
811763
def test_set_timeout_wrong_args(self):
812764
"""
813765
`Context.set_timeout` raises `TypeError` if called with
@@ -827,16 +779,6 @@ def test_timeout(self):
827779
context.set_timeout(1234)
828780
assert context.get_timeout() == 1234
829781

830-
@skip_if_py3
831-
def test_timeout_long(self):
832-
"""
833-
On Python 2 `Context.set_timeout` accepts values of type `long` as
834-
well as int.
835-
"""
836-
context = Context(TLSv1_METHOD)
837-
context.set_timeout(long(1234))
838-
assert context.get_timeout() == 1234
839-
840782
def test_set_verify_depth_wrong_args(self):
841783
"""
842784
`Context.set_verify_depth` raises `TypeError` if called with a
@@ -856,16 +798,6 @@ def test_verify_depth(self):
856798
context.set_verify_depth(11)
857799
assert context.get_verify_depth() == 11
858800

859-
@skip_if_py3
860-
def test_verify_depth_long(self):
861-
"""
862-
On Python 2 `Context.set_verify_depth` accepts values of type `long`
863-
as well as int.
864-
"""
865-
context = Context(TLSv1_METHOD)
866-
context.set_verify_depth(long(11))
867-
assert context.get_verify_depth() == 11
868-
869801
def _write_encrypted_pem(self, passphrase, tmpfile):
870802
"""
871803
Write a new private key out to a new file, encrypted using the given
@@ -1486,19 +1418,6 @@ def test_set_verify_mode(self):
14861418
VERIFY_PEER | VERIFY_CLIENT_ONCE, lambda *args: None)
14871419
assert context.get_verify_mode() == (VERIFY_PEER | VERIFY_CLIENT_ONCE)
14881420

1489-
@skip_if_py3
1490-
def test_set_verify_mode_long(self):
1491-
"""
1492-
On Python 2 `Context.set_verify_mode` accepts values of type `long`
1493-
as well as `int`.
1494-
"""
1495-
context = Context(TLSv1_METHOD)
1496-
assert context.get_verify_mode() == 0
1497-
context.set_verify(
1498-
long(VERIFY_PEER | VERIFY_CLIENT_ONCE), lambda *args: None
1499-
) # pragma: nocover
1500-
assert context.get_verify_mode() == (VERIFY_PEER | VERIFY_CLIENT_ONCE)
1501-
15021421
@pytest.mark.parametrize('mode', [None, 1.0, object(), 'mode'])
15031422
def test_set_verify_wrong_mode_arg(self, mode):
15041423
"""
@@ -1604,16 +1523,6 @@ def test_session_cache_mode(self):
16041523
assert SESS_CACHE_OFF == off
16051524
assert SESS_CACHE_BOTH == context.get_session_cache_mode()
16061525

1607-
@skip_if_py3
1608-
def test_session_cache_mode_long(self):
1609-
"""
1610-
On Python 2 `Context.set_session_cache_mode` accepts values
1611-
of type `long` as well as `int`.
1612-
"""
1613-
context = Context(TLSv1_METHOD)
1614-
context.set_session_cache_mode(long(SESS_CACHE_BOTH))
1615-
assert SESS_CACHE_BOTH == context.get_session_cache_mode()
1616-
16171526
def test_get_cert_store(self):
16181527
"""
16191528
`Context.get_cert_store` returns a `X509Store` instance.
@@ -2401,16 +2310,6 @@ def test_set_shutdown(self):
24012310
connection.set_shutdown(RECEIVED_SHUTDOWN)
24022311
assert connection.get_shutdown() == RECEIVED_SHUTDOWN
24032312

2404-
@skip_if_py3
2405-
def test_set_shutdown_long(self):
2406-
"""
2407-
On Python 2 `Connection.set_shutdown` accepts an argument
2408-
of type `long` as well as `int`.
2409-
"""
2410-
connection = Connection(Context(TLSv1_METHOD), socket_any_family())
2411-
connection.set_shutdown(long(RECEIVED_SHUTDOWN))
2412-
assert connection.get_shutdown() == RECEIVED_SHUTDOWN
2413-
24142313
def test_state_string(self):
24152314
"""
24162315
`Connection.state_string` verbosely describes the current state of
@@ -2868,22 +2767,6 @@ def test_buffer_size(self):
28682767
data = conn.bio_read(2)
28692768
assert 2 == len(data)
28702769

2871-
@skip_if_py3
2872-
def test_buffer_size_long(self):
2873-
"""
2874-
On Python 2 `Connection.bio_read` accepts values of type `long` as
2875-
well as `int`.
2876-
"""
2877-
ctx = Context(TLSv1_METHOD)
2878-
conn = Connection(ctx, None)
2879-
conn.set_connect_state()
2880-
try:
2881-
conn.do_handshake()
2882-
except WantReadError:
2883-
pass
2884-
data = conn.bio_read(long(2))
2885-
assert 2 == len(data)
2886-
28872770

28882771
class TestConnectionGetCipherList(object):
28892772
"""

0 commit comments

Comments
 (0)