Skip to content

Commit

Permalink
Merge pull request #43 from rachelhsmith/chore/37-get-tox-working
Browse files Browse the repository at this point in the history
Get Tox Working
  • Loading branch information
jams2 committed Jun 21, 2023
2 parents 02488bc + a7d8f82 commit ac83e99
Show file tree
Hide file tree
Showing 7 changed files with 683 additions and 1,221 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
branches: [main]
pull_request:

env:
PYTHON_VERSION: '3.10'

jobs:
test_node:
runs-on: ubuntu-latest
Expand All @@ -29,15 +26,18 @@ jobs:
- run: npm run report:package
test_python:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
id: setup-python
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: ${{ matrix.python }}
- uses: snok/install-poetry@v1
with:
version: '1.1.13'
version: '1.4.1'
virtualenvs-create: true
virtualenvs-in-project: true
- id: poetry-cache
Expand All @@ -54,5 +54,5 @@ jobs:
- run: poetry run djlint --check tests
# Lint the project's templates
- run: poetry run djlint tbxforms
- run: poetry run pytest
- run: poetry run tox
- run: poetry build
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pids
*.pyc
*.pyo
*.pot
.pytest_cache

# -------------------------------------------------
# Instrumentation and tooling
Expand Down Expand Up @@ -95,4 +96,4 @@ lib64
# Generated files
.cache-loader
localhost:8000
*.local
*.local
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
- Template linting to CI using `djlint`
- Snapshot formatting check to CI using `djlint`
- Autoformatting of snapshots using `djlint`
- Testing accross Django versions 2.2 - 4.0 and Python versions 3.8 - 3.11 using `tox`
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ We welcome all support, whether on bug reports, code, design, reviews, tests, do

### Installation

With Python 3.8 or up, Node 16, and [pre-commit](https://pre-commit.com/),
With Python 3.8 or up, Node 16, [pre-commit](https://pre-commit.com/) and [Poetry 1.4.1](https://python-poetry.org/docs/#installing-with-the-official-installer)

```bash
git clone git@github.com:torchbox/tbxforms.git
cd tbxforms/
pip install poetry==1.1.13
poetry install
pre-commit install
npm install
Expand Down
1,826 changes: 654 additions & 1,172 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ pre-commit = "2.15.0"
beautifulsoup4 = ">=4.8,<4.10.0"
coverage = "6.1.1"
pymdown-extensions = "9.0"
poetry = "1.1.13"
syrupy = "4.0.1"
tox = ">=4.4,<4.5"

# Linters etc.
black = "22.3.0"
Expand Down Expand Up @@ -97,5 +97,5 @@ extension = "html"
profile = "django"

[build-system]
requires = ["poetry==1.1.13"]
build-backend = "poetry.masonry.api"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
53 changes: 16 additions & 37 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,48 +1,27 @@
[tox]
envlist =
py{37,38,39,310}-dj{22,30,31,32,40}
flake8
isort
black
envlist = py{38,39,310,311}-dj{22,30,31,32,40}
skip_missing_interpreters = True
isolated_build = True
basepython = python3

[gh-actions]
python =
3.8: python3.8
3.9: python3.9
3.10: python3.10
3.11: python3.11

[testenv]
allowlist_externals = pytest
setenv =
PYTHONPATH = {toxinidir}
DJANGO_SETTINGS_MODULE = tests.settings
deps =
dj22: Django>=2.2,<2.3
dj30: Django>=3.0,<3.1
dj31: Django>=3.1,<3.2
dj32: Django>=3.2,<3.3
dj40: Django>=4.0,<4.1

install_command = pip install -U {opts} {packages}
commands =
; Install any dependencies that have changed since this
; tox env was created. Installing in editable mode because it is faster.
pip install -e .
coverage run --source="{toxinidir}/tbxforms" -m django test {posargs:tbxforms}
django-admin collectstatic --noinput
django-admin check
django-admin makemigrations --check --noinput
coverage report -m --omit="{toxinidir}/tbxforms/tests/*"
extras = testing

[testenv:black]
basepython = python3
commands =
black --check ./

[testenv:flake8]
basepython = python3
commands =
flake8 tbxforms

[testenv:isort]
basepython = python3
usedevelop = false
changedir = {toxinidir}
dj32: Django>=3.2,<4.0
dj31: Django>=3.1,<3.2
dj30: Django>=3.0,<3.1
dj22: Django>=2.2,<2.3
extras = test
commands =
isort --recursive --check-only --diff tbxforms
pytest

0 comments on commit ac83e99

Please sign in to comment.