Skip to content

Commit

Permalink
Use GitHub actions for tests
Browse files Browse the repository at this point in the history
- replace all tests by GitHub actions
- fix some tests failing in real fs due to different environment
  • Loading branch information
mrbean-bremen committed Nov 21, 2020
1 parent 12abe91 commit 6646762
Show file tree
Hide file tree
Showing 22 changed files with 145 additions and 356 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
79 changes: 79 additions & 0 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Python package

on: [push]

jobs:
linter:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install linter
run: python -m pip install flake8
- name: Check syntax and style
run: flake8 . --exclude get-pip.py --max-complexity=13 --statistics

tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-2016]
python-version: [3.6, 3.7, 3.8, 3.9]
include:
- python-version: pypy3
os: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r extra_requirements.txt
pip install .
- name: Run unit tests with extra packages as non-root user
run: |
python -m pyfakefs.tests.all_tests
- name: Run unit tests without extra packages as non-root user
run: |
export TEST_REAL_FS=1
python -m pyfakefs.tests.all_tests_without_extra_packages
shell: bash
- name: Run unit tests without extra packages as root
run: |
if [[ '${{ matrix.os }}' != 'windows-2016' ]]; 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: Run pytest tests
run: |
export PY_VERSION=${{ matrix.python-version }}
$GITHUB_WORKSPACE/.github/workflows/run_pytest.sh
shell: bash

dockertests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
docker-image: [centos, debian, fedora, ubuntu]
steps:
- uses: actions/checkout@v2
- name: Setup docker container
run: |
docker build -t pyfakefs -f $GITHUB_WORKSPACE/.github/workflows/dockerfiles/Dockerfile_${{ matrix.docker-image }} . --build-arg github_repo=$GITHUB_REPOSITORY --build-arg github_branch=$(basename $GITHUB_REF)
- name: Run tests
run: docker run -t pyfakefs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/bash

if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
source ~/.venv/bin/activate
python -m pytest pyfakefs/pytest_tests/pytest_plugin_test.py
if [[ $PY_VERSION == '3.6' ]] || [[ $PY_VERSION == '3.7' ]] || [[ $PY_VERSION == '3.8' ]] || [[ $PY_VERSION == '3.9' ]] ; then
python -m pytest pyfakefs/pytest_tests/pytest_fixture_test.py
fi

python -m pytest pyfakefs/pytest_tests/pytest_plugin_failing_helper.py > ./testresult.txt
python -m pytest pyfakefs/pytest_tests/pytest_check_failed_plugin_test.py && \
python -m pytest pyfakefs/pytest_tests/pytest_plugin_test.py
python -m pytest pyfakefs/pytest_tests/pytest_check_failed_plugin_test.py
164 changes: 0 additions & 164 deletions .travis.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .travis/docker_tests.sh

This file was deleted.

47 changes: 0 additions & 47 deletions .travis/install.sh

This file was deleted.

6 changes: 0 additions & 6 deletions .travis/run_flake.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .travis/run_pytest_fixture_param_test.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .travis/run_pytest_fixture_test.sh

This file was deleted.

11 changes: 0 additions & 11 deletions .travis/run_tests_as_root.sh

This file was deleted.

10 changes: 0 additions & 10 deletions .travis/run_tests_no_extra_packages.sh

This file was deleted.

11 changes: 0 additions & 11 deletions .travis/run_tests_with_extra_packages.sh

This file was deleted.

3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ The released versions correspond to PyPi releases.

## Version 4.4.0 (as yet unreleased)

### Infrastructure
* Moved CI builds to GitHub Actions for performance reasons

## [Version 4.3.0](https://pypi.python.org/pypi/pyfakefs/4.3.0) (2020-11-19)

This is mostly a performance release. The performance of the pyfakefs setup has
Expand Down
Loading

0 comments on commit 6646762

Please sign in to comment.