Skip to content

Use OS-specific delimiters for fake Windows/PosixPath #833

Use OS-specific delimiters for fake Windows/PosixPath

Use OS-specific delimiters for fake Windows/PosixPath #833

Workflow file for this run

name: Testsuite
on:
[push, pull_request]
defaults:
run:
shell: bash
jobs:
pytype:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: install pytype
run: pip install setuptools pytype pytest scandir pathlib2 pandas xlrd django pyarrow
- name: Run pytype
run: |
pytype pyfakefs --keep-going --exclude pyfakefs/tests/* --exclude pyfakefs/pytest_tests/*
tests:
runs-on: ${{ matrix.os }}
env:
PYTHONWARNDEFAULTENCODING: true
PIP_DISABLE_PIP_VERSION_CHECK: 1
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13-dev"]
include:
- python-version: "pypy-3.7"
os: ubuntu-latest
- python-version: "pypy-3.9"
os: ubuntu-latest
- python-version: "pypy-3.10"
os: ubuntu-latest
exclude:
- python-version: 3.7
os: macOS-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
id: pip-cache
shell: bash
run: |
python -m pip install --upgrade pip
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
id: cache-dep
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/extra_requirements.txt') }}-${{ hashFiles('**/legacy_requirements.txt') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.python-version }}-pip-
- name: Install dependencies
run: |
pip install setuptools wheel
pip install -r requirements.txt
- name: Run unit tests without extra packages as non-root user
run: |
export TEST_REAL_FS=1
python -bb -m pyfakefs.tests.all_tests_without_extra_packages
shell: bash
- name: Run unit tests without extra packages as root
run: |
if [[ '${{ matrix.os }}' != 'windows-latest' ]]; then
# provide the same path as non-root to get the correct virtualenv
sudo env "PATH=$PATH" python -m pyfakefs.tests.all_tests_without_extra_packages
fi
shell: bash
- name: Install extra dependencies
if: ${{ matrix.python-version != 'pypy-3.10' && ( matrix.python-version != '3.13-dev' || matrix.os != 'windows-latest' ) }}
run: |
pip install -r extra_requirements.txt
pip install -r legacy_requirements.txt
if [[ '${{ matrix.python-version }}' != '3.13-dev' ]]; then
pip install zstandard cffi # needed to test #910
fi
shell: bash
- name: Run unit tests with extra packages as non-root user
if: ${{ matrix.python-version != 'pypy-3.10' && ( matrix.python-version != '3.13-dev' || matrix.os != 'windows-latest' ) }}
run: |
if [[ '${{ matrix.python-version }}' != '3.13-dev' ]]; then
export PYTHON_ZSTANDARD_IMPORT_POLICY=cffi # needed to test #910
fi
python -m pyfakefs.tests.all_tests
shell: bash
- name: Run performance tests
run: |
if [[ '${{ matrix.os }}' != 'macOS-latest' ]]; then
export TEST_PERFORMANCE=1
python -m pyfakefs.tests.performance_test
fi
shell: bash
pytest-test:
runs-on: ${{ matrix.os }}
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
python-version: ["3.9"]
pytest-version: [3.0.0, 3.5.1, 4.0.2, 4.5.0, 5.0.1, 5.4.3, 6.0.2, 6.2.5, 7.0.1, 7.4.4, 8.0.2, 8.1.2, 8.2.0]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -U pytest==${{ matrix.pytest-version }}
python -m pip install opentimelineio pandas parquet pyarrow
python -m pip install -e .
if [[ '${{ matrix.pytest-version }}' == '4.0.2' ]]; then
python -m pip install -U attrs==19.1.0
fi
shell: bash
- name: Run pytest tests
run: |
echo "$(python -m pytest pyfakefs/pytest_tests/pytest_plugin_failing_helper.py)" > ./testresult.txt
python -m pytest pyfakefs/pytest_tests
if [[ '${{ matrix.pytest-version }}' > '3.0.0' ]]; then
cd pyfakefs/pytest_tests/ns_package
python -m pytest --log-cli-level=INFO test
fi
shell: bash
dependency-check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r extra_requirements.txt
pip install -r legacy_requirements.txt
pip install pytest-find-dependencies
- name: Check dependencies
run: python -m pytest --find-dependencies pyfakefs/tests
shell: bash