Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/linux.yaml → .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
name: linux-tests
name: tests


on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
# Python 3.3 and 3.4 have been removed since github won't provide these anymore
# As of 2023/01/09, we have removed python 3.5 and 3.6 as they don't work anymore with linux on github
# As of 2023/08/30, we have removed python 2.7 since github actions won't provide it anymore
# As of 2025/01/20, we have removed python 3.7 since github actions won't povide it anymore
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13", 'pypy-3.6', 'pypy-3.7', 'pypy-3.8', 'pypy-3.10']
# Remember kids, the default shell on Windows is Powershell
os: [linux-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13", "pypy-3.8", "pypy-3.10"]

steps:
- uses: actions/checkout@v3
Expand All @@ -25,7 +27,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
if [ -f command_runner/requirements.txt ]; then pip install -r command_runner/requirements.txt; fi
pip install -r command_runner/requirements.txt
- name: Generate Report
env:
RUNNING_ON_GITHUB_ACTIONS: true
Expand Down
39 changes: 0 additions & 39 deletions .github/workflows/windows.yaml

This file was deleted.

17 changes: 14 additions & 3 deletions tests/test_command_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@
return True if platform.python_implementation().lower() == "pypy" else False


def is_macos():
"""
Checks if under Mac OS
"""
return platform.system().lower() == "darwin"


def test_standard_ping_with_encoding():
"""
Test command_runner with a standard ping and encoding parameter
Expand Down Expand Up @@ -243,9 +250,13 @@

# WIP We could improve tests here by capturing logs
"""
valid_exit_codes = [0, 1, 2]
if is_macos():
valid_exit_codes.append(68) # ping non-existent exits with such on Mac
for method in methods:
exit_code, _ = command_runner('ping nonexistent_host', shell=True, valid_exit_codes=[0, 1, 2], method=method)
assert exit_code in [0, 1, 2], 'Exit code not in valid list with method {}'.format(method)

exit_code, _ = command_runner('ping nonexistent_host', shell=True, valid_exit_codes=valid_exit_codes, method=method)
assert exit_code in valid_exit_codes, 'Exit code not in valid list with method {}'.format(method)

exit_code, _ = command_runner('ping nonexistent_host', shell=True, valid_exit_codes=True, method=method)
assert exit_code != 0, 'Exit code should not be equal to 0'
Expand Down Expand Up @@ -768,4 +779,4 @@
test_split_streams()
test_on_exit()
test_priority()
test_no_close_queues()
test_no_close_queues()

Check warning on line 782 in tests/test_command_runner.py

View check run for this annotation

Codecov / codecov/patch

tests/test_command_runner.py#L782

Added line #L782 was not covered by tests
Loading