mirror of
https://github.com/google/pybadges.git
synced 2026-01-07 03:40:09 +01:00
10
noxfile.py
10
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)
|
||||
|
||||
|
||||
2
server-example/requirements-test.txt
Normal file
2
server-example/requirements-test.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
-r requirements.txt
|
||||
pytest
|
||||
30
server-example/test_app.py
Normal file
30
server-example/test_app.py
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user