tests: make use of the stdlib unittest.mock for python 3.3+ #283
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Python test | |
on: | |
push: | |
branches: [ "*" ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
run_tests: | |
name: Run Python Tests | |
strategy: | |
matrix: | |
include: | |
- { os: ubuntu-latest, python_version: '2.7' } | |
- { os: ubuntu-20.04, python_version: '3.5' } | |
- { os: ubuntu-20.04, python_version: '3.6' } | |
- { os: ubuntu-20.04, python_version: '3.7' } | |
- { os: ubuntu-22.04, python_version: '3.8' } | |
- { os: ubuntu-24.04, python_version: '3.9' } | |
- { os: ubuntu-latest, python_version: '3.10' } | |
- { os: ubuntu-latest, python_version: '3.11' } | |
- { os: ubuntu-latest, python_version: '3.12' } | |
- { os: macos-13, python_version: '3.7' } | |
- { os: macos-latest, python_version: '3.8' } | |
- { os: macos-latest, python_version: '3.9' } | |
- { os: macos-latest, python_version: '3.10' } | |
- { os: macos-latest, python_version: '3.11' } | |
- { os: macos-latest, python_version: '3.12' } | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up 3.5 Python, ${{ matrix.python_version }} | |
if: ${{ matrix.python_version == '3.5' }} | |
uses: actions/setup-python@v5 | |
env: | |
# Workaround copied from | |
# https://github.com/ytdl-org/youtube-dl/commit/a08f2b7e4567cdc50c0614ee0a4ffdff49b8b6e6 | |
PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org" | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Set up Python ${{ matrix.python_version }} | |
uses: andreafrancia/setup-python@v1 | |
if: ${{ matrix.python_version != '3.5' }} | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip | |
- name: Install dependencies | |
run: python -m pip install -r requirements-dev.txt -r requirements.txt | |
- name: Check Types | |
run: ./scripts/check-types | |
if: matrix.python_version != '2.7' | |
- name: Run tests | |
run: python -m pytest | |
sdist: | |
name: Test sdist creation | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python_version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Test sdist | |
run: scripts/test-sdist |