1name: Testsuite 2 3on: 4 [push, pull_request] 5 6jobs: 7 pytype: 8 runs-on: ubuntu-latest 9 steps: 10 - name: Check out repository 11 uses: actions/checkout@v3 12 - name: Set up Python 13 uses: actions/setup-python@v4 14 with: 15 python-version: "3.10" 16 - name: install pytype 17 run: pip install setuptools pytype pytest scandir pathlib2 pandas xlrd django 18 - name: Run pytype 19 run: | 20 pytype pyfakefs --keep-going --exclude pyfakefs/tests/* --exclude pyfakefs/pytest_tests/* 21 22 tests: 23 runs-on: ${{ matrix.os }} 24 strategy: 25 fail-fast: false 26 matrix: 27 os: [ubuntu-latest, macOS-latest, windows-latest] 28 python-version: ["3.8", "3.9", "3.10", "3.11", "3.12-dev"] 29 include: 30 - python-version: "pypy-3.7" 31 os: ubuntu-latest 32 - python-version: "pypy-3.9" 33 os: ubuntu-latest 34 - python-version: "pypy-3.10" 35 os: ubuntu-latest 36 37 steps: 38 - uses: actions/checkout@v3 39 - name: Set up Python ${{ matrix.python-version }} 40 uses: actions/setup-python@v4 41 with: 42 python-version: ${{ matrix.python-version }} 43 44 - name: Get pip cache dir 45 id: pip-cache 46 run: | 47 python -m pip install --upgrade pip 48 echo "::set-output name=dir::$(pip cache dir)" 49 50 - name: Cache dependencies 51 id: cache-dep 52 uses: actions/cache@v3 53 with: 54 path: ${{ steps.pip-cache.outputs.dir }} 55 key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/extra_requirements.txt') }} 56 restore-keys: | 57 ${{ matrix.os }}-${{ matrix.python-version }}-pip- 58 59 - name: Install dependencies 60 run: | 61 pip install setuptools wheel 62 pip install -r requirements.txt 63 - name: Run unit tests without extra packages as non-root user 64 run: | 65 export TEST_REAL_FS=1 66 python -bb -m pyfakefs.tests.all_tests_without_extra_packages 67 shell: bash 68 - name: Run setup.py test (uses pytest) 69 run: | 70 python setup.py test 71 shell: bash 72 - name: Run unit tests without extra packages as root 73 run: | 74 if [[ '${{ matrix.os }}' != 'windows-latest' ]]; then 75 # provide the same path as non-root to get the correct virtualenv 76 sudo env "PATH=$PATH" python -m pyfakefs.tests.all_tests_without_extra_packages 77 fi 78 shell: bash 79 - name: Install extra dependencies 80 if: ${{ matrix.python-version != '3.12-dev' }} 81 run: | 82 pip install -r extra_requirements.txt 83 shell: bash 84 - name: Run unit tests with extra packages as non-root user 85 if: ${{ matrix.python-version != '3.12-dev' }} 86 run: | 87 python -m pyfakefs.tests.all_tests 88 shell: bash 89 - name: Run performance tests 90 run: | 91 if [[ '${{ matrix.os }}' != 'macOS-latest' ]]; then 92 export TEST_PERFORMANCE=1 93 python -m pyfakefs.tests.performance_test 94 fi 95 shell: bash 96 97 pytest-test: 98 runs-on: ${{ matrix.os }} 99 strategy: 100 fail-fast: false 101 matrix: 102 os: [ubuntu-latest, macOS-latest, windows-latest] 103 python-version: ["3.9"] 104 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.1.3, 7.2.0, 7.3.1, 7.4.0] 105 steps: 106 - uses: actions/checkout@v3 107 - name: Set up Python ${{ matrix.python-version }} 108 uses: actions/setup-python@v4 109 with: 110 python-version: ${{ matrix.python-version }} 111 - name: Install dependencies 112 run: | 113 pip install -r requirements.txt 114 pip install -U pytest==${{ matrix.pytest-version }} 115 pip install opentimelineio 116 pip install -e . 117 if [[ '${{ matrix.pytest-version }}' == '4.0.2' ]]; then 118 pip install -U attrs==19.1.0 119 fi 120 shell: bash 121 - name: Run pytest tests 122 run: | 123 echo "$(python -m pytest pyfakefs/pytest_tests/pytest_plugin_failing_helper.py)" > ./testresult.txt 124 python -m pytest pyfakefs/pytest_tests 125 if [[ '${{ matrix.pytest-version }}' > '3.0.0' ]]; then 126 cd pyfakefs/pytest_tests/ns_package 127 python -m pytest --log-cli-level=INFO test 128 fi 129 shell: bash 130 131 dependency-check: 132 runs-on: ${{ matrix.os }} 133 strategy: 134 matrix: 135 os: [ubuntu-latest, windows-latest] 136 python-version: ["3.10"] 137 steps: 138 - uses: actions/checkout@v3 139 - name: Set up Python ${{ matrix.python-version }} 140 uses: actions/setup-python@v4 141 with: 142 python-version: ${{ matrix.python-version }} 143 - name: Install dependencies 144 run: | 145 pip install -r requirements.txt 146 pip install -r extra_requirements.txt 147 pip install pytest-find-dependencies 148 - name: Check dependencies 149 run: python -m pytest --find-dependencies pyfakefs/tests 150 shell: bash 151