Skip to content

Commit

Permalink
Merge branch 'master' into issue-363-better-ux-listview
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun authored Mar 5, 2024
2 parents c8879b2 + 8a4e6c9 commit 5ef01fc
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 74 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Cache dependencies
uses: actions/cache@v3.3.1
uses: actions/cache@v4.0.1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
Expand All @@ -39,12 +39,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Cache dependencies
uses: actions/cache@v3.3.1
uses: actions/cache@v4.0.1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
Expand Down
31 changes: 11 additions & 20 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
name: Lint
name: Ruff

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
pull_request:

jobs:
ruff:
name: ruff
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'
- run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run Ruff
run: |
ruff djangocms_versioning tests
- uses: actions/checkout@v4

- run: python -Im pip install --user ruff

- name: Run ruff
run: ruff --output-format=github djangocms_versioning tests
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-live-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand Down
70 changes: 53 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ 3.9, "3.10", "3.11", ] # latest release minus two
python-version: [ 3.9, "3.10", "3.11", "3.12" ] # latest release minus two
requirements-file: [
dj32_cms41.txt,
dj40_cms41.txt,
Expand All @@ -21,10 +21,10 @@ jobs:
]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}

uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -37,14 +37,14 @@ jobs:
run: coverage run setup.py test

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4

postgres:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ 3.9, "3.10", "3.11", ] # latest release minus two
python-version: [ 3.9, "3.10", "3.11", "3.12" ] # latest release minus two
requirements-file: [
dj32_cms41.txt,
dj40_cms41.txt,
Expand All @@ -65,10 +65,10 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}

uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -83,14 +83,14 @@ jobs:
DATABASE_URL: postgres://postgres:[email protected]/postgres

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4

mysql:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ 3.9, "3.10", "3.11", ] # latest release minus two
python-version: [ 3.9, "3.10", "3.11", "3.12" ] # latest release minus two
requirements-file: [
dj32_cms41.txt,
dj40_cms41.txt,
Expand All @@ -109,10 +109,10 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}

uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -127,7 +127,7 @@ jobs:
DATABASE_URL: mysql://[email protected]/djangocms_test

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4

cms-develop-sqlite:
runs-on: ${{ matrix.os }}
Expand All @@ -144,21 +144,57 @@ jobs:
]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}

uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements/${{ matrix.requirements-file }}
pip install ${{ matrix.cms-version }}
python -m pip install -r tests/requirements/${{ matrix.requirements-file }}
python -m pip install ${{ matrix.cms-version }}
python setup.py install
- name: Run coverage
run: coverage run setup.py test

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4

sqlite-django-main:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.11" ]
cms-version: [
'https://github.com/django-cms/django-cms/archive/develop-4.tar.gz'
]
django-version: [
'https://github.com/django/django/archive/main.tar.gz'
]
requirements-file: [
requirements_base.txt,
]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}

uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r tests/requirements/${{ matrix.requirements-file }}
python -m pip install ${{ matrix.cms-version }} ${{ matrix.django-version }}
python setup.py install
- name: Run coverage
run: coverage run setup.py test

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ repos:
- id: check-merge-conflict
- id: mixed-line-ending

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.264"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
1 change: 1 addition & 0 deletions djangocms_versioning/management/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

31 changes: 16 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
[tool.ruff]
# https://beta.ruff.rs/docs/configuration/
exclude = [
".eggs",
".git",
".mypy_cache",
".ruff_cache",
".env",
".venv",
"**migrations/**",
"node_modules",
"venv",
]
line-length = 120

[tool.ruff.lint]
# https://beta.ruff.rs/docs/configuration/
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
Expand All @@ -15,18 +28,6 @@ select = [
"UP", # pyupgrade
]

exclude = [
".eggs",
".git",
".mypy_cache",
".ruff_cache",
".env",
".venv",
"**migrations/**",
"node_modules",
"venv",
]

ignore = [
"B006", # Do not use mutable data structures for argument defaults
"B011", # tests use assert False
Expand All @@ -43,12 +44,12 @@ ignore = [
"UP007", # Use `X | Y` for type annotations
]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"F401" # unused-import
]

[tool.ruff.isort]
[tool.ruff.lint.isort]
combine-as-imports = true
known-first-party = [
"djangocms_versioning",
Expand Down
14 changes: 9 additions & 5 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
from djangocms_versioning.test_utils.polls.cms_config import PollsCMSConfig
from djangocms_versioning.test_utils.polls.models import Answer, Poll, PollContent

if not hasattr(CMSTestCase, "assertQuerySetEqual"):
# Django < 4.2
CMSTestCase.assertQuerySetEqual = CMSTestCase.assertQuerysetEqual


class BaseStateTestCase(CMSTestCase):
def assertRedirectsToVersionList(self, response, version):
Expand Down Expand Up @@ -268,7 +272,7 @@ def test_only_fetches_latest_content_records(self):
with self.login_user_context(self.get_superuser()):
response = self.client.get(self.get_admin_url(PollContent, "changelist"))

self.assertQuerysetEqual(
self.assertQuerySetEqual(
response.context["cl"].queryset,
[poll_content1.pk, poll_content2.pk, poll_content3.pk],
transform=lambda x: x.pk,
Expand All @@ -291,7 +295,7 @@ def test_records_filtering_is_generic(self):
with self.login_user_context(self.get_superuser()):
response = self.client.get(self.get_admin_url(BlogContent, "changelist"))

self.assertQuerysetEqual(
self.assertQuerySetEqual(
response.context["cl"].queryset,
[blog_content1.pk, blog_content2.pk],
transform=lambda x: x.pk,
Expand Down Expand Up @@ -2124,7 +2128,7 @@ def test_compare_view_has_version_data_in_context_when_no_get_param(self):
self.assertNotIn("v2", context)
self.assertNotIn("v2_preview_url", context)
self.assertIn("version_list", context)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
context["version_list"],
[versions[0].pk, versions[1].pk],
transform=lambda o: o.pk,
Expand Down Expand Up @@ -2184,7 +2188,7 @@ def test_compare_view_has_version_data_in_context_when_version2_in_get_param(sel
self.disable_toolbar_params,
)
self.assertIn("version_list", context)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
context["version_list"],
[versions[0].pk, versions[1].pk, versions[2].pk],
transform=lambda o: o.pk,
Expand Down Expand Up @@ -2310,7 +2314,7 @@ def test_grouper_filtering(self):

self.assertEqual(response.status_code, 200)
self.assertIn("cl", response.context)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
response.context["cl"].queryset,
[pv.pk],
transform=lambda x: x.pk,
Expand Down
Loading

0 comments on commit 5ef01fc

Please sign in to comment.