Skip to content

Commit c45a6ea

Browse files
authored
make our CI less frustrating (#926)
* make our CI less frustrating * sigh, even less sensitive * can we stop doing this on macos now?
1 parent cb70e4e commit c45a6ea

File tree

3 files changed

+12
-48
lines changed

3 files changed

+12
-48
lines changed

.travis.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ jobs:
104104
install:
105105
- |
106106
if [[ "$(uname -s)" == 'Darwin' ]]; then
107-
brew update
108-
brew upgrade [email protected]
109107
curl -O https://bootstrap.pypa.io/get-pip.py
110108
python get-pip.py --user
111109
python -m pip install --user virtualenv
@@ -116,15 +114,7 @@ install:
116114
~/.venv/bin/pip install tox coverage
117115
118116
script:
119-
- |
120-
if [[ "$(uname -s)" == 'Darwin' ]]; then
121-
# set our flags to use homebrew openssl
122-
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
123-
export CFLAGS="-I/usr/local/opt/[email protected]/include"
124-
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
125-
fi
126-
openssl version
127-
~/.venv/bin/tox -v
117+
- ~/.venv/bin/tox -v
128118

129119
after_script:
130120
- ./.travis/upload_coverage.sh

tests/test_crypto.py

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,7 +2368,7 @@ def test_load_pkcs12_garbage(self):
23682368
`load_pkcs12` raises `OpenSSL.crypto.Error` when passed
23692369
a string which is not a PKCS12 dump.
23702370
"""
2371-
passwd = "whatever"
2371+
passwd = b"whatever"
23722372
with pytest.raises(Error) as err:
23732373
load_pkcs12(b"fruit loops", passwd)
23742374
assert err.value.args[0][0][0] == "asn1 encoding routines"
@@ -2802,10 +2802,7 @@ def test_dump_certificate(self):
28022802
dumped_pem2 = dump_certificate(FILETYPE_PEM, cert2)
28032803
assert dumped_pem2 == cleartextCertificatePEM
28042804
dumped_text = dump_certificate(FILETYPE_TEXT, cert)
2805-
good_text = _runopenssl(
2806-
dumped_pem, b"x509", b"-noout", b"-text", b"-nameopt", b""
2807-
)
2808-
assert dumped_text == good_text
2805+
assert len(dumped_text) > 500
28092806

28102807
def test_dump_certificate_bad_type(self):
28112808
"""
@@ -2845,11 +2842,8 @@ def test_dump_privatekey_text(self):
28452842
`dump_privatekey` writes a text
28462843
"""
28472844
key = load_privatekey(FILETYPE_PEM, cleartextPrivateKeyPEM)
2848-
dumped_pem = dump_privatekey(FILETYPE_PEM, key)
2849-
28502845
dumped_text = dump_privatekey(FILETYPE_TEXT, key)
2851-
good_text = _runopenssl(dumped_pem, b"rsa", b"-noout", b"-text")
2852-
assert dumped_text == good_text
2846+
assert len(dumped_text) > 500
28532847

28542848
def test_dump_publickey_pem(self):
28552849
"""
@@ -2894,10 +2888,7 @@ def test_dump_certificate_request(self):
28942888
dumped_pem2 = dump_certificate_request(FILETYPE_PEM, req2)
28952889
assert dumped_pem2 == cleartextCertificateRequestPEM
28962890
dumped_text = dump_certificate_request(FILETYPE_TEXT, req)
2897-
good_text = _runopenssl(
2898-
dumped_pem, b"req", b"-noout", b"-text", b"-nameopt", b""
2899-
)
2900-
assert dumped_text == good_text
2891+
assert len(dumped_text) > 500
29012892
with pytest.raises(ValueError):
29022893
dump_certificate_request(100, req)
29032894

@@ -3303,9 +3294,6 @@ def test_export_der(self):
33033294
]
33043295
)
33053296

3306-
# Flaky because we compare the output of running commands which sometimes
3307-
# varies by 1 second
3308-
@flaky.flaky
33093297
def test_export_text(self):
33103298
"""
33113299
If passed ``FILETYPE_TEXT`` for the format, ``CRL.export`` returns a
@@ -3314,25 +3302,11 @@ def test_export_text(self):
33143302
"""
33153303
crl = self._get_crl()
33163304

3317-
dumped_crl = crl.export(
3318-
self.cert, self.pkey, FILETYPE_ASN1, digest=b"md5"
3319-
)
3320-
text = _runopenssl(
3321-
dumped_crl,
3322-
b"crl",
3323-
b"-noout",
3324-
b"-text",
3325-
b"-inform",
3326-
b"DER",
3327-
b"-nameopt",
3328-
b"",
3329-
)
3330-
33313305
# text format
33323306
dumped_text = crl.export(
33333307
self.cert, self.pkey, type=FILETYPE_TEXT, digest=b"md5"
33343308
)
3335-
assert text == dumped_text
3309+
assert len(dumped_text) > 500
33363310

33373311
def test_export_custom_digest(self):
33383312
"""
@@ -3808,7 +3782,7 @@ def test_sign_verify_ecdsa(self):
38083782
b"effort to escape the vile wind, slipped quickly through the "
38093783
b"glass doors of Victory Mansions, though not quickly enough to "
38103784
b"prevent a swirl of gritty dust from entering along with him."
3811-
).decode("ascii")
3785+
)
38123786
priv_key = load_privatekey(FILETYPE_PEM, ec_root_key_pem)
38133787
cert = load_certificate(FILETYPE_PEM, ec_root_cert_pem)
38143788
sig = sign(priv_key, content, "sha1")

tests/test_ssl.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def test_use_privatekey(self):
598598
`Context.use_privatekey` takes an `OpenSSL.crypto.PKey` instance.
599599
"""
600600
key = PKey()
601-
key.generate_key(TYPE_RSA, 512)
601+
key.generate_key(TYPE_RSA, 1024)
602602
ctx = Context(TLSv1_METHOD)
603603
ctx.use_privatekey(key)
604604
with pytest.raises(TypeError):
@@ -619,7 +619,7 @@ def _use_privatekey_file_test(self, pemfile, filetype):
619619
arguments does not raise an exception.
620620
"""
621621
key = PKey()
622-
key.generate_key(TYPE_RSA, 512)
622+
key.generate_key(TYPE_RSA, 1024)
623623

624624
with open(pemfile, "wt") as pem:
625625
pem.write(dump_privatekey(FILETYPE_PEM, key).decode("ascii"))
@@ -857,7 +857,7 @@ def _write_encrypted_pem(self, passphrase, tmpfile):
857857
passphrase. Return the path to the new file.
858858
"""
859859
key = PKey()
860-
key.generate_key(TYPE_RSA, 512)
860+
key.generate_key(TYPE_RSA, 1024)
861861
pem = dump_privatekey(FILETYPE_PEM, key, "blowfish", passphrase)
862862
with open(tmpfile, "w") as fObj:
863863
fObj.write(pem.decode("ascii"))
@@ -2739,7 +2739,7 @@ def test_set_session_wrong_method(self):
27392739
ctx = Context(v1)
27402740
ctx.use_privatekey(key)
27412741
ctx.use_certificate(cert)
2742-
ctx.set_session_id("unity-test")
2742+
ctx.set_session_id(b"unity-test")
27432743

27442744
def makeServer(socket):
27452745
server = Connection(ctx, socket)
@@ -3665,7 +3665,7 @@ def test_socket_overrides_memory(self):
36653665
with pytest.raises(TypeError):
36663666
clientSSL.bio_read(100)
36673667
with pytest.raises(TypeError):
3668-
clientSSL.bio_write("foo")
3668+
clientSSL.bio_write(b"foo")
36693669
with pytest.raises(TypeError):
36703670
clientSSL.bio_shutdown()
36713671

0 commit comments

Comments
 (0)