Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #136 from pquentin/merge-from-master-2019-10-30
Browse files Browse the repository at this point in the history
Merge from master (October 30th, 2019)
  • Loading branch information
RatanShreshtha authored Nov 14, 2019
2 parents f5ff1ac + f331ec4 commit b5dc270
Show file tree
Hide file tree
Showing 25 changed files with 241 additions and 366 deletions.
2 changes: 1 addition & 1 deletion _travis/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -exo pipefail

python3 -m pip install --upgrade twine
python3 -m pip install --upgrade twine wheel
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/* -u $PYPI_USERNAME -p $PYPI_PASSWORD --skip-existing
16 changes: 8 additions & 8 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
mock==2.0.0
mock==3.0.5
coverage~=4.5
wheel==0.30.0
tornado==5.1.1
PySocks==1.6.8
pkginfo==1.4.2
PySocks==1.7.1
# https://github.com/Anorov/PySocks/issues/131
win-inet-pton==1.1.0
pytest==4.6.6
pytest-random-order==1.0.4;python_version>="3.5"
pytest-timeout==1.3.3
pytest==4.6.4
pytest-cov==2.7.1
h11==0.8.0
cryptography==2.6.1

# https://github.com/ionelmc/python-lazy-object-proxy/issues/30
lazy-object-proxy==1.4.0
flaky==3.6.1

# https://github.com/GoogleCloudPlatform/python-repo-tools/issues/23
pylint<2.0;python_version<="2.7"
gcp-devrel-py-tools

# optional dependencies, only intended for use with Python 3.5+
trio==0.3.0; python_version >= "3.5"
# https://github.com/mhammond/pywin32/issues/1439
pywin32!=226; python_version >= "3.5" and os_name == 'nt'
twisted[tls]==19.2.0; python_version >= "3.5" and os_name != 'nt'
twisted[tls,windows_platform]==19.2.0; python_version >= "3.5" and os_name == 'nt'
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ urllib3 can be installed with `pip <https://pip.pypa.io>`_::

Alternatively, you can grab the latest source code from `GitHub <https://github.com/urllib3/urllib3>`_::

$ git clone git://github.com/shazow/urllib3.git
$ git clone git://github.com/urllib3/urllib3.git
$ python setup.py install

Usage
Expand Down
23 changes: 0 additions & 23 deletions dummyserver/certs/client.csr

This file was deleted.

15 changes: 0 additions & 15 deletions dummyserver/certs/client.key

This file was deleted.

21 changes: 0 additions & 21 deletions dummyserver/certs/client.pem

This file was deleted.

15 changes: 0 additions & 15 deletions dummyserver/certs/intermediate.key

This file was deleted.

18 changes: 0 additions & 18 deletions dummyserver/certs/intermediate.pem

This file was deleted.

12 changes: 2 additions & 10 deletions dummyserver/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@
DEFAULT_CLIENT_CERTS = {
"certfile": os.path.join(CERTS_PATH, "client_intermediate.pem"),
"keyfile": os.path.join(CERTS_PATH, "client_intermediate.key"),
"subject": dict(
countryName=u"FI",
stateOrProvinceName=u"dummy",
organizationName=u"dummy",
organizationalUnitName=u"dummy",
commonName=u"SnakeOilClient",
emailAddress=u"[email protected]",
),
}
DEFAULT_CLIENT_NO_INTERMEDIATE_CERTS = {
"certfile": os.path.join(CERTS_PATH, "client_no_intermediate.pem"),
Expand Down Expand Up @@ -86,7 +78,7 @@ def _has_ipv6(host):
# has_ipv6 returns true if cPython was compiled with IPv6 support.
# It does not tell us if the system has IPv6 support enabled. To
# determine that we must bind to an IPv6 address.
# https://github.com/shazow/urllib3/pull/611
# https://github.com/urllib3/urllib3/pull/611
# https://bugs.python.org/issue658327
try:
sock = socket.socket(socket.AF_INET6)
Expand All @@ -102,7 +94,7 @@ def _has_ipv6(host):

# Some systems may have IPv6 support but DNS may not be configured
# properly. We can not count that localhost will resolve to ::1 on all
# systems. See https://github.com/shazow/urllib3/pull/611 and
# systems. See https://github.com/urllib3/urllib3/pull/611 and
# https://bugs.python.org/issue18792
HAS_IPV6_AND_DNS = _has_ipv6("localhost")
HAS_IPV6 = _has_ipv6("::1")
Expand Down
9 changes: 7 additions & 2 deletions dummyserver/testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@


def consume_socket(sock, chunks=65536):
while not sock.recv(chunks).endswith(b"\r\n\r\n"):
pass
consumed = bytearray()
while True:
b = sock.recv(chunks)
consumed += b
if b.endswith(b"\r\n\r\n"):
break
return consumed


class SocketDummyServerTestCase(object):
Expand Down
188 changes: 95 additions & 93 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,93 +1,95 @@
import os
import shutil

import nox


def tests_impl(session, extras="socks,secure,brotli"):
# Install deps and the package itself.
session.install("-r", "dev-requirements.txt")
session.install(".[{extras}]".format(extras=extras))

# Show the pip version.
session.run("pip", "--version")
# Print the Python version and bytesize.
session.run("python", "--version")
session.run("python", "-c", "import struct; print(struct.calcsize('P') * 8)")
# Print OpenSSL information.
session.run("python", "-m", "OpenSSL.debug")

session.run(
"pytest",
"-r",
"a",
"--cov=urllib3",
*(session.posargs or ("test/",)),
env={"PYTHONWARNINGS": "always::DeprecationWarning"}
)
session.run("coverage", "xml")
session.run("python", "cleancov.py", "coverage.xml")


@nox.session(python=["2.7", "3.4", "3.5", "3.6", "3.7", "3.8", "pypy"])
def test(session):
tests_impl(session)


@nox.session(python=["2", "3"])
def google_brotli(session):
# https://pypi.org/project/Brotli/ is the Google version of brotli, so
# install it separately and don't install our brotli extra (which installs
# brotlipy).
session.install("brotli")
tests_impl(session, extras="socks,secure")


@nox.session(python="2.7")
def app_engine(session):
session.install("-r", "dev-requirements.txt")
session.install(".")
session.run(
"coverage",
"run",
"--parallel-mode",
"-m",
"pytest",
"-r",
"sx",
"test/appengine",
*session.posargs
)
session.run("coverage", "combine")
session.run("coverage", "report", "-m")


@nox.session()
def blacken(session):
"""Run black code formater."""
session.install("black")
session.run("black", "src", "dummyserver", "test", "noxfile.py", "setup.py")

lint(session)


@nox.session
def lint(session):
session.install("flake8", "black")
session.run("flake8", "--version")
session.run("black", "--version")
session.run(
"black", "--check", "src", "dummyserver", "test", "noxfile.py", "setup.py"
)
session.run("flake8", "setup.py", "docs", "dummyserver", "src", "test")


@nox.session
def docs(session):
session.install("-r", "docs/requirements.txt")
session.install(".[socks,secure,brotli]")

session.chdir("docs")
if os.path.exists("_build"):
shutil.rmtree("_build")
session.run("sphinx-build", "-W", ".", "_build/html")
import os
import shutil

import nox


def tests_impl(session, extras="socks,secure,brotli"):
# Install deps and the package itself.
session.install("-r", "dev-requirements.txt")
session.install(".[{extras}]".format(extras=extras))

# Show the pip version.
session.run("pip", "--version")
# Print the Python version and bytesize.
session.run("python", "--version")
session.run("python", "-c", "import struct; print(struct.calcsize('P') * 8)")
# Print OpenSSL information.
session.run("python", "-m", "OpenSSL.debug")

session.run(
"pytest",
"-r",
"a",
"--tb=native",
"--cov=urllib3",
"--no-success-flaky-report",
*(session.posargs or ("test/",)),
env={"PYTHONWARNINGS": "always::DeprecationWarning"}
)
session.run("coverage", "xml")
session.run("python", "cleancov.py", "coverage.xml")


@nox.session(python=["2.7", "3.4", "3.5", "3.6", "3.7", "3.8", "pypy"])
def test(session):
tests_impl(session)


@nox.session(python=["2", "3"])
def google_brotli(session):
# https://pypi.org/project/Brotli/ is the Google version of brotli, so
# install it separately and don't install our brotli extra (which installs
# brotlipy).
session.install("brotli")
tests_impl(session, extras="socks,secure")


@nox.session(python="2.7")
def app_engine(session):
session.install("-r", "dev-requirements.txt")
session.install(".")
session.run(
"coverage",
"run",
"--parallel-mode",
"-m",
"pytest",
"-r",
"sx",
"test/appengine",
*session.posargs
)
session.run("coverage", "combine")
session.run("coverage", "report", "-m")


@nox.session()
def blacken(session):
"""Run black code formater."""
session.install("black")
session.run("black", "src", "dummyserver", "test", "noxfile.py", "setup.py")

lint(session)


@nox.session
def lint(session):
session.install("flake8", "black")
session.run("flake8", "--version")
session.run("black", "--version")
session.run(
"black", "--check", "src", "dummyserver", "test", "noxfile.py", "setup.py"
)
session.run("flake8", "setup.py", "docs", "dummyserver", "src", "test")


@nox.session
def docs(session):
session.install("-r", "docs/requirements.txt")
session.install(".[socks,secure,brotli]")

session.chdir("docs")
if os.path.exists("_build"):
shutil.rmtree("_build")
session.run("sphinx-build", "-W", ".", "_build/html")
2 changes: 1 addition & 1 deletion src/urllib3/_async/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ async def _wrap_socket(self, sock, ssl_context, fingerprint, assert_hostname):
"back to check for a `commonName` for now. This "
"feature is being removed by major browsers and "
"deprecated by RFC 2818. (See "
"https://github.com/shazow/urllib3/issues/497 for "
"https://github.com/urllib3/urllib3/issues/497 for "
"details.)".format(self._host)
),
SubjectAltNameWarning,
Expand Down
Loading

0 comments on commit b5dc270

Please sign in to comment.