Skip to content

Commit cc1c643

Browse files
authored
Merge pull request #1987 from EliahKagan/versions
Fix various version-related CI breakages
2 parents fb1b051 + 39cd608 commit cc1c643

File tree

4 files changed

+29
-23
lines changed

4 files changed

+29
-23
lines changed

.github/workflows/alpine-test.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
steps:
1717
- name: Prepare Alpine Linux
1818
run: |
19-
apk add sudo git git-daemon python3 py3-pip
19+
apk add sudo git git-daemon python3 py3-pip py3-virtualenv
2020
echo 'Defaults env_keep += "CI GITHUB_* RUNNER_*"' >/etc/sudoers.d/ci_env
2121
addgroup -g 127 docker
22-
adduser -D -u 1001 runner
22+
adduser -D -u 1001 runner # TODO: Check if this still works on GHA as intended.
2323
adduser runner docker
2424
shell: sh -exo pipefail {0} # Run this as root, not the "runner" user.
2525

@@ -47,20 +47,21 @@ jobs:
4747
- name: Set up virtualenv
4848
run: |
4949
python -m venv .venv
50-
. .venv/bin/activate
51-
printf '%s=%s\n' 'PATH' "$PATH" 'VIRTUAL_ENV' "$VIRTUAL_ENV" >>"$GITHUB_ENV"
5250
5351
- name: Update PyPA packages
5452
run: |
5553
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
54+
. .venv/bin/activate
5655
python -m pip install -U pip $(pip freeze --all | grep -ow ^setuptools) wheel
5756
5857
- name: Install project and test dependencies
5958
run: |
59+
. .venv/bin/activate
6060
pip install ".[test]"
6161
6262
- name: Show version and platform information
6363
run: |
64+
. .venv/bin/activate
6465
uname -a
6566
command -v git python
6667
git version
@@ -69,4 +70,5 @@ jobs:
6970
7071
- name: Test with pytest
7172
run: |
73+
. .venv/bin/activate
7274
pytest --color=yes -p no:sugar --instafail -vv

.github/workflows/cygwin-test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ jobs:
5555
# and cause subsequent tests to fail
5656
cat test/fixtures/.gitconfig >> ~/.gitconfig
5757
58-
- name: Ensure the "pip" command is available
58+
- name: Set up virtualenv
5959
run: |
60-
# This is used unless, and before, an updated pip is installed.
61-
ln -s pip3 /usr/bin/pip
60+
python -m venv .venv
61+
echo 'BASH_ENV=.venv/bin/activate' >>"$GITHUB_ENV"
6262
6363
- name: Update PyPA packages
6464
run: |

.github/workflows/pythonpackage.yml

+11-7
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ permissions:
1111
jobs:
1212
build:
1313
strategy:
14-
fail-fast: false
1514
matrix:
16-
os: ["ubuntu-22.04", "macos-latest", "windows-latest"]
17-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
18-
exclude:
19-
- os: "macos-latest"
20-
python-version: "3.7"
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2117
include:
2218
- experimental: false
19+
- os: ubuntu-22.04
20+
python-version: "3.7"
21+
experimental: false
22+
- os: windows-latest
23+
python-version: "3.7"
24+
experimental: false
25+
26+
fail-fast: false
2327

2428
runs-on: ${{ matrix.os }}
2529

@@ -40,7 +44,7 @@ jobs:
4044

4145
- name: Set up WSL (Windows)
4246
if: startsWith(matrix.os, 'windows')
43-
uses: Vampire/setup-wsl@v3.1.1
47+
uses: Vampire/setup-wsl@v4.0.0
4448
with:
4549
distribution: Alpine
4650
additional-packages: bash

test/test_git.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -762,14 +762,14 @@ def test_environment(self, rw_dir):
762762
def test_handle_process_output(self):
763763
from git.cmd import handle_process_output, safer_popen
764764

765-
line_count = 5002
766-
count = [None, 0, 0]
765+
expected_line_count = 5002
766+
actual_lines = [None, [], []]
767767

768-
def counter_stdout(line):
769-
count[1] += 1
768+
def stdout_handler(line):
769+
actual_lines[1].append(line)
770770

771-
def counter_stderr(line):
772-
count[2] += 1
771+
def stderr_handler(line):
772+
actual_lines[2].append(line)
773773

774774
cmdline = [
775775
sys.executable,
@@ -784,10 +784,10 @@ def counter_stderr(line):
784784
shell=False,
785785
)
786786

787-
handle_process_output(proc, counter_stdout, counter_stderr, finalize_process)
787+
handle_process_output(proc, stdout_handler, stderr_handler, finalize_process)
788788

789-
self.assertEqual(count[1], line_count)
790-
self.assertEqual(count[2], line_count)
789+
self.assertEqual(len(actual_lines[1]), expected_line_count, repr(actual_lines[1]))
790+
self.assertEqual(len(actual_lines[2]), expected_line_count, repr(actual_lines[2]))
791791

792792
def test_execute_kwargs_set_agrees_with_method(self):
793793
parameter_names = inspect.signature(cmd.Git.execute).parameters.keys()

0 commit comments

Comments
 (0)