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

Support and Test Against Django 5 #686

Merged
merged 4 commits into from
Jan 19, 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
13 changes: 12 additions & 1 deletion .github/workflows/test.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍🏼

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
django-version: ['3.2', '4.1', '4.2', 'main']
django-version: ['3.2', '4.1', '4.2', '5.0', 'main']
postgres-version: ['11', '12']
mariadb-version: ['10.3', '10.4']
exclude:
Expand All @@ -26,6 +26,12 @@ jobs:
- python-version: '3.12' # TODO remove this once Django 4.2.8 is released
django-version: '4.2'

# Django 5.0 doesn't support python <=3.9k (https://docs.djangoproject.com/en/5.0/faq/install/)
- python-version: '3.8'
django-version: '5.0'
- python-version: '3.9'
django-version: '5.0'

# only test Django dev with PostgreSQL 12 and MariaDB 10.4
- django-version: '3.2'
postgres-version: '12'
Expand All @@ -42,6 +48,11 @@ jobs:
- django-version: '4.2'
mariadb-version: '10.3'

- django-version: '5.0'
postgres-version: '11'
- django-version: '5.0'
mariadb-version: '10.3'

- django-version: 'main'
postgres-version: '11'
- django-version: 'main'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Silk is a live profiling and inspection tool for the Django framework. Silk inte

Silk has been tested with:

* Django: 3.2, 4.1, 4.2
* Django: 3.2, 4.1, 4.2, 5.0
* Python: 3.8, 3.9, 3.10, 3.11, 3.12

## Installation
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ Features
Requirements
------------

* Django: 3.2, 4.1, 4.2
* Django: 3.2, 4.1, 4.2, 5.0
* Python: 3.8, 3.9, 3.10
12 changes: 12 additions & 0 deletions project/tests/test_execute_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def setUpClass(cls):
super().setUpClass()
call_execute_sql(cls, None)

def tearDown(self):
DataCollector().stop_python_profiler()

def test_called(self):
self.mock_sql._execute_sql.assert_called_once_with(*self.args, **self.kwargs)

Expand All @@ -65,6 +68,9 @@ def setUpClass(cls):
super().setUpClass()
call_execute_sql(cls, Request())

def tearDown(self):
DataCollector().stop_python_profiler()

def test_called(self):
self.mock_sql._execute_sql.assert_called_once_with(*self.args, **self.kwargs)

Expand All @@ -77,6 +83,9 @@ def test_query(self):


class TestCallSilky(TestCase):
def tearDown(self):
DataCollector().stop_python_profiler()

def test_no_effect(self):
DataCollector().configure()
sql, _ = mock_sql()
Expand All @@ -89,6 +98,9 @@ def test_no_effect(self):


class TestCollectorInteraction(TestCase):
def tearDown(self):
DataCollector().stop_python_profiler()

def _query(self):
try:
query = list(DataCollector().queries.values())[0]
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.1',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
Expand Down
1 change: 1 addition & 0 deletions silk/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def request(self, value):
def _configure(self):
self.local.objects = {}
self.local.temp_identifier = 0
self.stop_python_profiler()
self.local.pythonprofiler = None

@property
Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ DJANGO =
3.2: dj32
4.1: dj41
4.2: dj42
5.0: dj50
main: djmain

[tox]
envlist =
py{38,39,310}-dj32-{sqlite3,mysql,postgresql}
py{38,39,310}-dj{40,41,42,main}-{sqlite3,mysql,postgresql}
py311-dj{41,42,main}-{sqlite3,mysql,postgresql}
py312-dj{42,main}-{sqlite3,mysql,postgresql}
py{38,39,310,311}-dj{41,42,50,main}-{sqlite3,mysql,postgresql}
py312-dj{42,50,main}-{sqlite3,mysql,postgresql}

[testenv]
usedevelop = True
Expand All @@ -32,6 +32,7 @@ deps =
dj32: django>=3.2,<3.3
dj41: django>=4.1,<4.2
dj42: django>=4.2,<4.3
dj50: django>=5.0,<5.1
djmain: https://github.com/django/django/archive/main.tar.gz
py312: setuptools
setenv =
Expand Down