diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9804d86d..42f22e75 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,21 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.8", "pypy-3.9", "pypy-3.10"] + python-version: + [ + "3.8", + "3.9", + "3.10", + "3.11", + "3.12", + "pypy-3.8", + "pypy-3.9", + "pypy-3.10", + ] + urllib3-version: ["urllib3"] + include: + - python-version: "3.10" + urllib3-version: "urllib3<2" steps: - uses: actions/checkout@v4 @@ -25,19 +39,16 @@ jobs: - name: Install project dependencies run: | - pip3 install --upgrade pip - pip3 install codecov tox tox-gh-actions + pip install --upgrade pip + pip install codecov .[tests] - - name: Run online tests with tox - run: tox -- -m online - - - name: Run offline tests with tox with no access to the Internet + - name: Install urllib3 + if: ${{ matrix.urllib3-version }} run: | - # We're using unshare to take Internet access - # away from tox so that we'll notice whenever some new test - # is missing @pytest.mark.online decoration in the future - unshare --map-root-user --net -- \ - sh -c 'ip link set lo up; tox -- -m "not online"' + pip install '${{ matrix.urllib3-version }}' + + - name: Run tests + run: ./runtests.sh --cov=./vcr --cov-branch --cov-report=xml --cov-append - name: Run coverage run: codecov diff --git a/setup.py b/setup.py index 71ba6a24..0a4792ae 100644 --- a/setup.py +++ b/setup.py @@ -57,24 +57,29 @@ def run_tests(self): "urllib3 <2; platform_python_implementation =='PyPy'", ] -tests_require = [ - "aiohttp", - "boto3", - "httplib2", - "httpx", - "pytest", - "pytest-aiohttp", - "pytest-httpbin", - "requests>=2.16.2", - "tornado", - # Needed to un-break httpbin 0.7.0. For httpbin >=0.7.1 and after, - # this pin and the dependency itself can be removed, provided - # that the related bug in httpbin has been fixed: - # https://github.com/kevin1024/vcrpy/issues/645#issuecomment-1562489489 - # https://github.com/postmanlabs/httpbin/issues/673 - # https://github.com/postmanlabs/httpbin/pull/674 - "Werkzeug==2.0.3", -] +tests_require = { + "tests": [ + "aiohttp", + "boto3", + "httplib2", + "httpx", + "pytest-aiohttp", + "pytest-asyncio", + "pytest-cov", + "pytest-httpbin", + "pytest", + "requests>=2.22.0", + "tornado", + "urllib3", + # Needed to un-break httpbin 0.7.0. For httpbin >=0.7.1 and after, + # this pin and the dependency itself can be removed, provided + # that the related bug in httpbin has been fixed: + # https://github.com/kevin1024/vcrpy/issues/645#issuecomment-1562489489 + # https://github.com/postmanlabs/httpbin/issues/673 + # https://github.com/postmanlabs/httpbin/pull/674 + "Werkzeug==2.0.3", + ], +} setup( name="vcrpy", @@ -89,7 +94,7 @@ def run_tests(self): python_requires=">=3.8", install_requires=install_requires, license="MIT", - tests_require=tests_require, + extras_require=tests_require, classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Console",