Skip to content
This repository was archived by the owner on Aug 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def _run_tests(session):
'py.test',
'--quiet',
'tests',
'server-example',
*session.posargs
)

Expand All @@ -33,24 +34,27 @@ def lint(session):
serious code quality issues.
"""
session.install('flake8')
session.run('flake8',
'pypadges,tests')
session.run('flake8', 'pybadges')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should probably be in another PR but it's fine this time.

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'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should probably be in another PR but it's fine this time.

@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)

Expand Down
2 changes: 2 additions & 0 deletions server-example/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r requirements.txt
pytest
30 changes: 30 additions & 0 deletions server-example/test_app.py
Original file line number Diff line number Diff line change
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a license to the top of this file? You can use any other file in the project as an example but make sure that you change the year to 2020.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, every file needs a comment explaining what it is doing.


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