From a19d3ae32313465edd6302ffe292a8a35756b96c Mon Sep 17 00:00:00 2001 From: Alex Tomkins Date: Fri, 8 Nov 2024 19:02:07 +0000 Subject: [PATCH 1/3] Avoid flask-webtest --- {{cookiecutter.project_slug}}/requirements/testing.txt | 1 - {{cookiecutter.project_slug}}/tests/conftest.py | 7 +++---- {{cookiecutter.project_slug}}/tests/test_views.py | 8 ++++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/{{cookiecutter.project_slug}}/requirements/testing.txt b/{{cookiecutter.project_slug}}/requirements/testing.txt index 38976f4..bd3a7f3 100644 --- a/{{cookiecutter.project_slug}}/requirements/testing.txt +++ b/{{cookiecutter.project_slug}}/requirements/testing.txt @@ -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 diff --git a/{{cookiecutter.project_slug}}/tests/conftest.py b/{{cookiecutter.project_slug}}/tests/conftest.py index a576754..504ef74 100644 --- a/{{cookiecutter.project_slug}}/tests/conftest.py +++ b/{{cookiecutter.project_slug}}/tests/conftest.py @@ -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 diff --git a/{{cookiecutter.project_slug}}/tests/test_views.py b/{{cookiecutter.project_slug}}/tests/test_views.py index d13e98b..8ccf437 100644 --- a/{{cookiecutter.project_slug}}/tests/test_views.py +++ b/{{cookiecutter.project_slug}}/tests/test_views.py @@ -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) From b31b784c4ed0f1e8302de4277b52a21652e34947 Mon Sep 17 00:00:00 2001 From: Alex Tomkins Date: Fri, 8 Nov 2024 19:03:57 +0000 Subject: [PATCH 2/3] Upgrade template tox --- requirements/local.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/local.txt b/requirements/local.txt index b3583ee..3cabe9a 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -1,3 +1,3 @@ -r testing.txt -tox==4.15.1 +tox==4.23.2 From f1a1cd0d8a6bcc679e1b60d460e338051c208d7f Mon Sep 17 00:00:00 2001 From: Alex Tomkins Date: Fri, 8 Nov 2024 19:06:55 +0000 Subject: [PATCH 3/3] Use tox-uv --- .github/workflows/ci.yml | 2 +- requirements/local.txt | 1 + {{cookiecutter.project_slug}}/.github/workflows/ci.yml | 2 +- {{cookiecutter.project_slug}}/requirements/local.txt | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c32a9ab..a279af9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/requirements/local.txt b/requirements/local.txt index 3cabe9a..9303029 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -1,3 +1,4 @@ -r testing.txt tox==4.23.2 +tox-uv==1.16.0 diff --git a/{{cookiecutter.project_slug}}/.github/workflows/ci.yml b/{{cookiecutter.project_slug}}/.github/workflows/ci.yml index c3bfdd1..5feceb9 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/ci.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/ci.yml @@ -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 diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 144eafd..e8a0301 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -2,3 +2,4 @@ ipdb==0.13.13 tox==4.23.2 +tox-uv==1.16.0