Skip to content

Commit

Permalink
[1.26] Fix running CPython 2.7 tests in CI (#3137)
Browse files Browse the repository at this point in the history
  • Loading branch information
illia-v authored Nov 15, 2023
1 parent 9c2c230 commit 7e2d389
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
os: [macos-11, windows-latest, ubuntu-latest]
experimental: [false]
nox-session: ['']
exclude:
# GitHub Actions dropped support for Python 2.7 and 3.7 in Ubuntu 22.04
- python-version: "2.7"
os: ubuntu-latest
# actions/setup-python dropped support for 3.6 in Ubuntu 22.04
- python-version: "3.6"
os: ubuntu-latest
# Python 3.7 does not fully support OpenSSL 3, the default on Ubuntu 22.04
Expand All @@ -45,7 +43,7 @@ jobs:
os: ubuntu-latest
include:
- python-version: "2.7"
os: ubuntu-20.04
os: ubuntu-latest
experimental: false
nox-session: ''
- python-version: "3.6"
Expand Down Expand Up @@ -89,10 +87,20 @@ jobs:
uses: actions/checkout@v2

- name: Set Up Python - ${{ matrix.python-version }}
if: matrix.python-version != '2.7'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

# Unfortunately, actions/setup-python does not support CPython 2.7.
- name: Set Up Python - 2.7
if: matrix.python-version == '2.7'
run: |
sudo apt update
sudo apt install python2.7-dev python-is-python3
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2.7 get-pip.py
- name: Set Up Python 3 to run nox
if: matrix.python-version == '2.7' || matrix.python-version == 'pypy2.7'
uses: actions/setup-python@v4
Expand Down
2 changes: 1 addition & 1 deletion ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

if [[ "${NOX_SESSION}" == "app_engine" ]]; then
export GAE_SDK_PATH=$HOME/.cache/google_appengine
python2 -m pip install gcp-devrel-py-tools==0.0.16
python2.7 -m pip install gcp-devrel-py-tools==0.0.16
gcp-devrel-py-tools download-appengine-sdk "$(dirname ${GAE_SDK_PATH})"
fi

Expand Down
3 changes: 2 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ 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")
# https://github.com/google/brotli/issues/1074
session.install("brotli==1.0.9" if session.python == "2.7" else "brotli")
tests_impl(session, extras="socks,secure")


Expand Down
2 changes: 1 addition & 1 deletion src/urllib3/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def connect(self):
and self.ssl_version is None
and hasattr(self.sock, "version")
and self.sock.version() in {"TLSv1", "TLSv1.1"}
):
): # Defensive:
warnings.warn(
"Negotiating TLSv1/TLSv1.1 by default is deprecated "
"and will be disabled in urllib3 v2.0.0. Connecting to "
Expand Down

0 comments on commit 7e2d389

Please sign in to comment.