Skip to content

Commit cd9597b

Browse files
committed
ci: move PYTHON_PKGS into pyproject.toml as a testing extra
Add a 'testing' optional-dependency group to pyproject.toml containing pytest and pytest-asyncio, so the test environment can be installed on any machine with 'pip install .[testing]'. Update all three CI workflows to use the new extra instead of the inline PYTHON_PKGS environment variable: - tests.yml: pip install .[testing] build - test_ssh.yml: pip install .[testing,ssh] build - test_ltx.yml: pip install .[testing,ltx] Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
1 parent 0dd9d49 commit cd9597b

4 files changed

Lines changed: 5 additions & 11 deletions

File tree

.github/workflows/test_ltx.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
name: "Test LTX"
44
on: [push, pull_request]
55

6-
env:
7-
PYTHON_PKGS: pytest pytest-asyncio msgpack
8-
96
jobs:
107
python3:
118
runs-on: ubuntu-22.04
@@ -37,7 +34,7 @@ jobs:
3734
python-version: ${{ matrix.python-version }}
3835

3936
- name: Install dependencies
40-
run: pip install $PYTHON_PKGS
37+
run: pip install .[testing,ltx]
4138

4239
- name: Checkout ltx
4340
uses: actions/checkout@v5

.github/workflows/test_ssh.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ name: "Test SSH"
44
on: push
55

66
env:
7-
PYTHON_PKGS: pytest pytest-asyncio build asyncssh
87
TEST_SSH_KEY_FILE: /home/runner/.ssh/id_rsa
98
TEST_SSH_USERNAME: runner
109
TEST_SSH_PASSWORD: password
@@ -41,7 +40,7 @@ jobs:
4140
python-version: ${{ matrix.python-version }}
4241

4342
- name: Install dependencies
44-
run: python3 -m pip install $PYTHON_PKGS
43+
run: python3 -m pip install .[testing,ssh] build
4544

4645
- name: Setup user password
4746
run: echo "$TEST_SSH_USERNAME:$TEST_SSH_PASSWORD" | sudo chpasswd

.github/workflows/tests.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
name: "Test packages"
44
on: [push, pull_request]
55

6-
env:
7-
PYTHON_PKGS: pytest pytest-asyncio build
8-
96
jobs:
107
python3-deprecated:
118
runs-on: ubuntu-22.04
@@ -24,7 +21,7 @@ jobs:
2421
run: zypper install -y python3-pip make
2522

2623
- name: Install dependencies
27-
run: pip install $PYTHON_PKGS
24+
run: pip install pytest pytest-asyncio build
2825

2926
- name: Build package
3027
run: python3 -m build
@@ -62,7 +59,7 @@ jobs:
6259
python-version: ${{ matrix.python-version }}
6360

6461
- name: Install dependencies
65-
run: python3 -m pip install $PYTHON_PKGS
62+
run: python3 -m pip install .[testing] build
6663

6764
- name: Build package
6865
run: python3 -m build

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ exclude = ["libkirk.tests"]
4848
kirk = "libkirk.main:run"
4949

5050
[project.optional-dependencies]
51+
testing = ["pytest", "pytest-asyncio"]
5152
ssh = ["asyncssh <= 2.17.0"]
5253
ltx = ["msgpack <= 1.1.0"]
5354
docs = [

0 commit comments

Comments
 (0)