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

Make pre comit deps normal deps #9

Closed
wants to merge 7 commits into from
Closed
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
44 changes: 32 additions & 12 deletions laces/test/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Tests for the example views that demonstrate the use of components."""
from http import HTTPStatus

import django

from django.test import RequestFactory, TestCase

from laces.test.example.views import kitchen_sink
Expand Down Expand Up @@ -52,21 +54,39 @@ def test_get(self):
response_html,
)
self.assertInHTML("<h1>Hello Media</h1>", response_html)
self.assertInHTML(
'<link href="/static/component.css" media="all" rel="stylesheet">',
response_html,
)
if django.VERSION < (4, 0):
# Before Django 4.0 the markup was including the (useless)
# `type="text/css"` attribute.
self.assertInHTML(
'<link href="/static/component.css" type="text/css" media="all" rel="stylesheet">', # noqa: E501
response_html,
)
else:
self.assertInHTML(
'<link href="/static/component.css" media="all" rel="stylesheet">',
response_html,
)
self.assertInHTML('<script src="/static/component.js"></script>', response_html)
self.assertInHTML("<header>Header with Media</header>", response_html)
self.assertInHTML("<footer>Footer with Media</footer>", response_html)
self.assertInHTML(
'<link href="/static/header.css" media="all" rel="stylesheet">',
response_html,
)
self.assertInHTML(
'<link href="/static/footer.css" media="all" rel="stylesheet">',
response_html,
)
if django.VERSION < (4, 0):
self.assertInHTML(
'<link href="/static/header.css" type="text/css" media="all" rel="stylesheet">', # noqa: E501
response_html,
)
self.assertInHTML(
'<link href="/static/footer.css" type="text/css" media="all" rel="stylesheet">', # noqa: E501
response_html,
)
else:
self.assertInHTML(
'<link href="/static/header.css" media="all" rel="stylesheet">',
response_html,
)
self.assertInHTML(
'<link href="/static/footer.css" media="all" rel="stylesheet">',
response_html,
)
self.assertInHTML('<script src="/static/header.js"></script>', response_html)
self.assertInHTML('<script src="/static/footer.js"></script>', response_html)
self.assertInHTML(
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ testing = [
"coverage==7.3.4",
]
ci = [
"tox==4.11.3",
"tox-gh-actions==3.1.3",
"tox==4.12.1",
"tox-gh-actions==3.2.0",
# Allow use of pyenv for virtual environments. To enable you need to set `VIRTUALENV_DISCOVERY=pyenv` in the shell.
# This is useful to help tox find the correct python version when using pyenv.
"virtualenv-pyenv==0.4.0"
Expand Down
15 changes: 8 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[tox]
skipsdist = True
usedevelop = True

envlist =
python{3.8,3.9,3.10,3.11}-django{3.2,4.1,4.2}

Expand All @@ -17,11 +14,18 @@ DB =
sqlite: sqlite

[testenv]
install_command = pip install -e ".[testing]" -U {opts} {packages}
package = editable
extras = testing

commands_pre =
# Mostly to check that the requirements are in order
python -m pip freeze

commands =
# Run coverage in append mode so that we get a combined report over all environments.
# This can not be combined with parallel mode.
# This only affects local working, because each env is run on a different runner in CI.
# In CI, Codecov will combine the reports.
coverage run -a testmanage.py test --deprecation all {posargs: -v 2}

commands_post =
Expand All @@ -35,9 +39,6 @@ basepython =
python3.11: python3.11

deps =
# Coverage is required here (even though it's in pyproject.toml) to make it work on GitHub Actions
coverage

django3.2: Django>=3.2,<4.0
django4.0: Django>=4.0,<4.1
django4.1: Django>=4.1,<4.2
Expand Down