Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better testing #78

Merged
merged 3 commits into from
Nov 8, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('.nvmrc', 'package.json', 'package-lock.json') }}
- name: Run tests
run: |
pip install $(grep "^tox==" requirements/local.txt)
pip install $(grep -E "^(tox|tox-uv)==" requirements/local.txt)
tox -e ${{ matrix.testenv }}
3 changes: 2 additions & 1 deletion requirements/local.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-r testing.txt

tox==4.15.1
tox==4.23.2
tox-uv==1.16.0
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('.nvmrc', 'package.json', 'package-lock.json') }}
- name: Run tests
run: |
pip install $(grep "^tox==" requirements/local.txt)
pip install $(grep -E "^(tox|tox-uv)==" requirements/local.txt)
tox
1 change: 1 addition & 0 deletions {{cookiecutter.project_slug}}/requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

ipdb==0.13.13
tox==4.23.2
tox-uv==1.16.0
1 change: 0 additions & 1 deletion {{cookiecutter.project_slug}}/requirements/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
black==24.10.0
coverage==7.6.4
flake8==7.1.1
Flask-WebTest==0.1.6
isort==5.13.2
pipdeptree==2.23.4
pytest-flask==1.3.0
Expand Down
7 changes: 3 additions & 4 deletions {{cookiecutter.project_slug}}/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import pytest
from flask_webtest import TestApp

from project import app
import project


@pytest.fixture
def flask_webtest(request):
request.cls.app = TestApp(app)
def app():
return project.app
8 changes: 4 additions & 4 deletions {{cookiecutter.project_slug}}/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import pytest


@pytest.mark.usefixtures("flask_webtest")
@pytest.mark.usefixtures("client_class")
class TestViews(unittest.TestCase):
def test_root(self):
response = self.app.get("/")
response = self.client.get("/")

assert response.status_int == 200
assert "Hello, world!" in response
assert response.status_code == 200
assert "Hello, world!" in response.get_data(as_text=True)
Loading