Skip to content

Commit

Permalink
chore: use tox to run wheel tests. make daphne optional when testing
Browse files Browse the repository at this point in the history
  • Loading branch information
CaselIT committed Dec 7, 2020
1 parent 1df2c0b commit 4c77a99
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 31 deletions.
32 changes: 8 additions & 24 deletions .github/workflows/create-wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,8 @@ jobs:
FALCON_ASGI_WRAP_NON_COROUTINES: Y
FALCON_TESTING_SESSION: Y
run: |
pip install -f dist --no-index falcon
python -c 'import sys; sys.path.pop(0); from falcon.cyutil import misc, reader, uri'
pip install 'setuptools>=44'
pip install -r requirements/tests
pytest -q tests ${{ matrix.pytest-extra }}
pip install 'tox>=3.20'
tox -e wheel_check -- ${{ matrix.pytest-extra }}
- name: Get wheel name
id: wheel-name
Expand Down Expand Up @@ -180,11 +177,8 @@ jobs:
FALCON_ASGI_WRAP_NON_COROUTINES: Y
FALCON_TESTING_SESSION: Y
run: |
pip install 'setuptools>=44'
pip install -f dist --no-index falcon
python -c 'import sys; sys.path.pop(0); from falcon.cyutil import misc, reader, uri'
pip install -r requirements/tests
pytest -q tests ${{ matrix.pytest-extra }}
pip install 'tox>=3.20'
tox -e wheel_check -- ${{ matrix.pytest-extra }}
- name: Get wheel names
id: wheel-name
Expand Down Expand Up @@ -359,14 +353,8 @@ jobs:
args: |
bash -c "
export PATH=/opt/python/${{ matrix.python-version }}/bin:$PATH &&
yum install -y openssl-devel &&
pip install -f dist --no-index falcon &&
pip install 'setuptools>=44' 'cryptography<3.2' &&
python -c 'import sys; sys.path.pop(0); from falcon.cyutil import misc, reader, uri' &&
[[ $PYTHON_VERSION != 'cp35-cp35m' ]] && (
pip install -r requirements/tests &&
pytest -q tests ${{ matrix.pytest-extra }}
) || echo 'Install requirements fails on python 3.5 on arm. Skipping tests.'
pip install 'tox>=3.20' 'pip>=20' &&
tox -e wheel_check -- ${{ matrix.pytest-extra }}
"
- name: Create wheel for manylinux 2014 for s390x
Expand All @@ -389,12 +377,8 @@ jobs:
args: |
bash -c "
export PATH=/opt/python/${{ matrix.python-version }}/bin:$PATH &&
yum install -y openssl-devel &&
pip install -f dist --no-index falcon &&
pip install 'setuptools>=44' 'cryptography<3.2' &&
python -c 'import sys; sys.path.pop(0); from falcon.cyutil import misc, reader, uri' &&
pip install -r requirements/tests &&
pytest -q tests ${{ matrix.pytest-extra }}
pip install 'tox>=3.20' 'pip>=20' &&
tox -e wheel_check -- ${{ matrix.pytest-extra }}
"
- name: Get wheel name
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- "look"
- "check_vendored"
- "twine_check"
- "daphne"
# TODO(kgriffs): Re-enable once hug has a chance to address
# breaking changes in Falcon 3.0
# - "hug"
Expand Down
10 changes: 5 additions & 5 deletions requirements/tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ pyyaml
requests
testtools

# ASGI Specific
# ASGI Specific (daphne is installed on a its own tox env)
pytest-asyncio
httpx; python_version >= '3.6'
uvicorn; python_version >= '3.6'
aiofiles; python_version >= '3.6'
daphne; python_version >= '3.6' and sys_platform != 'win32'
httpx; python_version >= '3.6'
uvicorn; python_version >= '3.6'
websockets; python_version >= '3.6'
Expand All @@ -20,7 +19,8 @@ msgpack
mujson
ujson

python-rapidjson
# it's slow to compile on emulated architectures
python-rapidjson; platform_machine != 's390x' and platform_machine != 'aarch64'

# TODO(kgriffs): orjson is failing to build on CI
orjson; platform_python_implementation != 'PyPy' and platform_machine != 's390x'
# python_version >= '3.6': arm64 wheels are missing for py35
orjson; python_version >= '3.6' and platform_python_implementation != 'PyPy' and platform_machine != 's390x'
13 changes: 11 additions & 2 deletions tests/asgi/test_asgi_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,20 @@ def _daphne_factory(host, port):
)


def _can_run(factory):
if _WIN32 and factory == _daphne_factory:
pytest.skip('daphne does not support windows')
if factory == _daphne_factory:
try:
import daphne # noqa
except Exception:
pytest.skip('daphne not installed')


@pytest.fixture(params=[_uvicorn_factory, _daphne_factory])
def server_base_url(request):
process_factory = request.param
if _WIN32 and process_factory == _daphne_factory:
pytest.skip('daphne does not support windows')
_can_run(process_factory)

for i in range(3):
server_port = testing.get_unused_port()
Expand Down
31 changes: 31 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ deps = -r{toxinidir}/requirements/tests
commands = {toxinidir}/tools/clean.sh {toxinidir}/falcon
pytest tests []

# --------------------------------------------------------------------
# Daphne
# --------------------------------------------------------------------

[testenv:daphne]
deps = {[testenv]deps}
daphne

# --------------------------------------------------------------------
# Coverage
# --------------------------------------------------------------------
Expand Down Expand Up @@ -350,3 +358,26 @@ deps = virtualenv
commands =
{toxinidir}/tools/testing/install_hug.sh
{toxinidir}/tools/testing/test_hug.sh

# --------------------------------------------------------------------
# Wheels stuff
# --------------------------------------------------------------------

[testenv:wheel_check]
basepython = python
skipsdist = True
skip_install = True
deps = setuptools>=44
pytest
setenv =
PYTHONASYNCIODEBUG=0
PYTHONNOUSERSITE=1
FALCON_ASGI_WRAP_NON_COROUTINES=Y
FALCON_TESTING_SESSION=Y
commands =
pip uninstall --yes falcon
pip install --find-links {toxinidir}/dist --no-index --ignore-installed falcon
python --version
python -c "import sys; sys.path.pop(0); from falcon.cyutil import misc, reader, uri"
pip install -r{toxinidir}/requirements/tests
pytest -q tests []

0 comments on commit 4c77a99

Please sign in to comment.