diff --git a/noxfile.py b/noxfile.py index d111040..12a4738 100644 --- a/noxfile.py +++ b/noxfile.py @@ -22,6 +22,7 @@ def _run_tests(session): 'py.test', '--quiet', 'tests', + 'server-example', *session.posargs ) @@ -33,24 +34,27 @@ def lint(session): serious code quality issues. """ session.install('flake8') - session.run('flake8', - 'pypadges,tests') + session.run('flake8', 'pybadges') + session.run('flake8', 'tests') + session.run('flake8', 'server-example') @nox.session def unit(session): """Run the unit test suite.""" session.install('-e', '.[dev]') + session.install('-r', 'server-example/requirements-test.txt') _run_tests(session) -@nox.session(python=['3.4', '3.5', '3.6', '3.7']) +@nox.session(python=['3.4', '3.5', '3.6', '3.7', '3.8']) @nox.parametrize('install', ['Jinja2==2.9.0', 'Pillow==5.0.0', 'requests==2.9.0', 'xmldiff==2.4']) def compatibility(session, install): """Run the unit test suite with each support library and Python version.""" session.install('-e', '.[dev]') + session.install('-r', 'server-example/requirements-test.txt') session.install(install) _run_tests(session) diff --git a/server-example/requirements-test.txt b/server-example/requirements-test.txt new file mode 100644 index 0000000..26b77f6 --- /dev/null +++ b/server-example/requirements-test.txt @@ -0,0 +1,2 @@ +-r requirements.txt +pytest diff --git a/server-example/test_app.py b/server-example/test_app.py new file mode 100644 index 0000000..36587b4 --- /dev/null +++ b/server-example/test_app.py @@ -0,0 +1,30 @@ +# Copyright 2020 The pybadge Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"Tests for app" + + +import pytest + +import app + +@pytest.fixture +def client(): + with app.app.test_client() as client: + yield client + +def test_image(client): + rv = client.get("/") + assert b'build' in rv.data + assert b'passing' in rv.data