summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2021-11-23 15:56:09 -0500
committerGitHub <noreply@github.com>2021-11-24 04:56:09 +0800
commit11b9bc5cb5efd5cafd9fe4cf7a99a1252213025b (patch)
treed760b05856c0d9759239f6cc09888d95a5ff32f2
parent853fefa6d0d8a5c191648a8870f83fe50d69c1e8 (diff)
downloadpyopenssl-11b9bc5cb5efd5cafd9fe4cf7a99a1252213025b.tar.gz
Remove some more py27-isms (#1062)
-rw-r--r--doc/conf.py10
-rw-r--r--pyproject.toml2
-rw-r--r--src/OpenSSL/debug.py2
-rw-r--r--tests/test_crypto.py30
-rw-r--r--tests/test_ssl.py14
-rw-r--r--tox.ini2
6 files changed, 30 insertions, 30 deletions
diff --git a/doc/conf.py b/doc/conf.py
index dd8d011..0aeedbf 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -72,9 +72,9 @@ source_suffix = ".rst"
master_doc = "index"
# General information about the project.
-project = u"pyOpenSSL"
-authors = u"The pyOpenSSL developers"
-copyright = u"2001 " + authors
+project = "pyOpenSSL"
+authors = "The pyOpenSSL developers"
+copyright = "2001 " + authors
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -217,7 +217,7 @@ htmlhelp_basename = "pyOpenSSLdoc"
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual])
latex_documents = [
- ("index", "pyOpenSSL.tex", u"pyOpenSSL Documentation", authors, "manual"),
+ ("index", "pyOpenSSL.tex", "pyOpenSSL Documentation", authors, "manual"),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -248,7 +248,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
-man_pages = [("index", "pyopenssl", u"pyOpenSSL Documentation", [authors], 1)]
+man_pages = [("index", "pyopenssl", "pyOpenSSL Documentation", [authors], 1)]
intersphinx_mapping = {
"https://docs.python.org/3": None,
diff --git a/pyproject.toml b/pyproject.toml
index ff6e2bb..c745476 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,4 +1,4 @@
[tool.black]
line-length = 79
-target-version = ["py27"]
+target-version = ["py36"]
diff --git a/src/OpenSSL/debug.py b/src/OpenSSL/debug.py
index 04521d5..988b92a 100644
--- a/src/OpenSSL/debug.py
+++ b/src/OpenSSL/debug.py
@@ -10,7 +10,7 @@ import cryptography
from . import version
-_env_info = u"""\
+_env_info = """\
pyOpenSSL: {pyopenssl}
cryptography: {cryptography}
cffi: {cffi}
diff --git a/tests/test_crypto.py b/tests/test_crypto.py
index ef3429d..1172e79 100644
--- a/tests/test_crypto.py
+++ b/tests/test_crypto.py
@@ -2467,7 +2467,7 @@ class TestPKCS12(object):
b"-nodes",
b"-passin",
b"pass:" + passwd,
- *extra
+ *extra,
)
assert recovered_key[-len(key) :] == key
if cert:
@@ -2479,7 +2479,7 @@ class TestPKCS12(object):
b"-passin",
b"pass:" + passwd,
b"-nokeys",
- *extra
+ *extra,
)
assert recovered_cert[-len(cert) :] == cert
if ca:
@@ -2491,7 +2491,7 @@ class TestPKCS12(object):
b"-passin",
b"pass:" + passwd,
b"-nokeys",
- *extra
+ *extra,
)
assert recovered_cert[-len(ca) :] == ca
@@ -3477,7 +3477,7 @@ class TestRevoked(object):
revoked.set_reason(None)
assert revoked.get_reason() is None
- @pytest.mark.parametrize("reason", [object(), 1.0, u"foo"])
+ @pytest.mark.parametrize("reason", [object(), 1.0, "foo"])
def test_set_reason_wrong_args(self, reason):
"""
`Revoked.set_reason` raises `TypeError` if called with an argument
@@ -3553,12 +3553,12 @@ class TestCRL(object):
assert revoked is not None
assert crl.issuer == x509.Name(
[
- x509.NameAttribute(x509.NameOID.COUNTRY_NAME, u"US"),
- x509.NameAttribute(x509.NameOID.STATE_OR_PROVINCE_NAME, u"IL"),
- x509.NameAttribute(x509.NameOID.LOCALITY_NAME, u"Chicago"),
- x509.NameAttribute(x509.NameOID.ORGANIZATION_NAME, u"Testing"),
+ x509.NameAttribute(x509.NameOID.COUNTRY_NAME, "US"),
+ x509.NameAttribute(x509.NameOID.STATE_OR_PROVINCE_NAME, "IL"),
+ x509.NameAttribute(x509.NameOID.LOCALITY_NAME, "Chicago"),
+ x509.NameAttribute(x509.NameOID.ORGANIZATION_NAME, "Testing"),
x509.NameAttribute(
- x509.NameOID.COMMON_NAME, u"Testing Root CA"
+ x509.NameOID.COMMON_NAME, "Testing Root CA"
),
]
)
@@ -3580,12 +3580,12 @@ class TestCRL(object):
assert revoked is not None
assert crl.issuer == x509.Name(
[
- x509.NameAttribute(x509.NameOID.COUNTRY_NAME, u"US"),
- x509.NameAttribute(x509.NameOID.STATE_OR_PROVINCE_NAME, u"IL"),
- x509.NameAttribute(x509.NameOID.LOCALITY_NAME, u"Chicago"),
- x509.NameAttribute(x509.NameOID.ORGANIZATION_NAME, u"Testing"),
+ x509.NameAttribute(x509.NameOID.COUNTRY_NAME, "US"),
+ x509.NameAttribute(x509.NameOID.STATE_OR_PROVINCE_NAME, "IL"),
+ x509.NameAttribute(x509.NameOID.LOCALITY_NAME, "Chicago"),
+ x509.NameAttribute(x509.NameOID.ORGANIZATION_NAME, "Testing"),
x509.NameAttribute(
- x509.NameOID.COMMON_NAME, u"Testing Root CA"
+ x509.NameOID.COMMON_NAME, "Testing Root CA"
),
]
)
@@ -4375,7 +4375,7 @@ class TestEllipticCurve(object):
does not identify a supported curve.
"""
with pytest.raises(ValueError):
- get_elliptic_curve(u"this curve was just invented")
+ get_elliptic_curve("this curve was just invented")
def test_repr(self):
"""
diff --git a/tests/test_ssl.py b/tests/test_ssl.py
index 05aeeee..3e424b6 100644
--- a/tests/test_ssl.py
+++ b/tests/test_ssl.py
@@ -454,10 +454,10 @@ def ca_file(tmpdir):
builder = x509.CertificateBuilder()
builder = builder.subject_name(
- x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, u"pyopenssl.org")])
+ x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, "pyopenssl.org")])
)
builder = builder.issuer_name(
- x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, u"pyopenssl.org")])
+ x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, "pyopenssl.org")])
)
one_day = datetime.timedelta(1, 0, 0)
builder = builder.not_valid_before(datetime.datetime.today() - one_day)
@@ -498,7 +498,7 @@ class TestContext(object):
@pytest.mark.parametrize(
"cipher_string",
- [b"hello world:AES128-SHA", u"hello world:AES128-SHA"],
+ [b"hello world:AES128-SHA", "hello world:AES128-SHA"],
)
def test_set_cipher_list(self, context, cipher_string):
"""
@@ -588,7 +588,7 @@ class TestContext(object):
`Context.set_session_id` raises a warning if a unicode string is
passed.
"""
- pytest.deprecated_call(context.set_session_id, u"abc")
+ pytest.deprecated_call(context.set_session_id, "abc")
def test_method(self):
"""
@@ -1708,7 +1708,7 @@ class TestContext(object):
"""
context = Context(SSLv23_METHOD)
for curve in get_elliptic_curves():
- if curve.name.startswith(u"Oakley-"):
+ if curve.name.startswith("Oakley-"):
# Setting Oakley-EC2N-4 and Oakley-EC2N-3 adds
# ('bignum routines', 'BN_mod_inverse', 'no inverse') to the
# error queue on OpenSSL 1.0.2.
@@ -2068,7 +2068,7 @@ class TestApplicationLayerProtoNegotiation(object):
def invalid_cb(conn, options):
invalid_cb_args.append((conn, options))
- return u"can't return unicode"
+ return "can't return unicode"
client_context = Context(SSLv23_METHOD)
client_context.set_alpn_protos([b"http/1.1", b"spdy/2"])
@@ -2235,7 +2235,7 @@ class TestConnection(object):
connection.bio_write(b"xy")
connection.bio_write(bytearray(b"za"))
with pytest.warns(DeprecationWarning):
- connection.bio_write(u"deprecated")
+ connection.bio_write("deprecated")
def test_get_context(self):
"""
diff --git a/tox.ini b/tox.ini
index 26b5b35..5883e7a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = {pypy,pypy3,py27,py36,py37,py38,py39,py310}{,-cryptographyMain,-cryptographyMinimum}{,-useWheel}{,-randomorder},py37-twistedTrunk,pypi-readme,check-manifest,flake8,docs,coverage-report
+envlist = {pypy,pypy3,py36,py37,py38,py39,py310}{,-cryptographyMain,-cryptographyMinimum}{,-useWheel}{,-randomorder},py37-twistedTrunk,pypi-readme,check-manifest,flake8,docs,coverage-report
[testenv]
whitelist_externals =