Skip to content

Commit

Permalink
Run tests without tox
Browse files Browse the repository at this point in the history
  • Loading branch information
jairhenrique committed Dec 11, 2023
1 parent 796dc8d commit 3406a87
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 33 deletions.
38 changes: 24 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@ 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",
]

steps:
- uses: actions/checkout@v4
Expand All @@ -25,19 +35,19 @@ jobs:

- name: Install project dependencies
run: |
pip3 install --upgrade pip
pip3 install codecov tox tox-gh-actions
- name: Run online tests with tox
run: tox -- -m online

- name: Run offline tests with tox with no access to the Internet
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 --upgrade pip
pip install codecov .[tests]
- name: Run tests
run: ./runtests.sh --cov=./vcr --cov-branch --cov-report=xml --cov-append

# - name: Run offline tests with no access to the Internet
# 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; ./runtests.sh --cov=./vcr --cov-branch --cov-report=xml --cov-append -m "not online"'

- name: Run coverage
run: codecov
43 changes: 24 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def run_tests(self):
"PyYAML",
"wrapt",
"yarl",
"urllib3",
# Support for urllib3 >=2 needs CPython >=3.10
# so we need to block urllib3 >=2 for Python <3.10 and PyPy for now.
# Note that vcrpy would work fine without any urllib3 around,
Expand All @@ -57,24 +58,28 @@ 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",
"pytest-cov",
"pytest-asyncio",
"pytest-aiohttp",
"pytest-httpbin",
"requests>=2.22.0",
"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",
],
}

setup(
name="vcrpy",
Expand All @@ -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",
Expand Down

0 comments on commit 3406a87

Please sign in to comment.