Skip to content

Commit

Permalink
Merge pull request #227 from rtibbles/python3.12
Browse files Browse the repository at this point in the history
Add Python 3.12 support
  • Loading branch information
rtibbles committed Jul 3, 2024
2 parents 882236c + 983d307 commit 03fec46
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 142 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
max-parallel: 5
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
python-version: [ 3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12' ]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
strategy:
max-parallel: 5
matrix:
python-version: [ 3.6, 3.7, 3.8, 3.9, '3.10', '3.11' ]
python-version: [ 3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12' ]

steps:
- uses: actions/checkout@v2
Expand All @@ -77,7 +77,7 @@ jobs:
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.tox/py${{ matrix.python-version }}
path: ${{ github.workspace }}/.tox/py${{ matrix.python-version }}-cryptography${{ env.cryptography_version }}
key: ${{ runner.os }}-tox-py${{ matrix.python-version }}-crypto${{ env.cryptography_version }}-${{ hashFiles('setup.py', 'requirements/*.txt') }}
- name: Test with tox
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
Expand Down Expand Up @@ -121,8 +121,8 @@ jobs:
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.tox/py3.6
key: ${{ runner.os }}-tox-py3.6-${{ hashFiles('setup.py', 'requirements/*.txt') }}
path: ${{ github.workspace }}/.tox/py3.9-postgres
key: ${{ runner.os }}-tox-py3.9-postgres-${{ hashFiles('setup.py', 'requirements/*.txt') }}
- name: Test with tox
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
run: tox -e postgres
Expand Down
1 change: 0 additions & 1 deletion morango/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
default_app_config = "morango.apps.MorangoConfig"
__version__ = "0.8.0"
1 change: 1 addition & 0 deletions morango/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class MorangoConfig(AppConfig):
name = "morango"
verbose_name = "Morango"
default_auto_field = "django.db.models.AutoField"

def ready(self):
from morango.models.signals import add_to_deleted_models # noqa: F401
Expand Down
2 changes: 1 addition & 1 deletion morango/constants/transfer_stages.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
This module contains constants representing the possible stages of a transfer session.
"""
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

INITIALIZING = "initializing"
SERIALIZING = "serializing"
Expand Down
2 changes: 1 addition & 1 deletion morango/constants/transfer_statuses.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
This module contains constants representing the possible statuses of a transfer session stage.
"""
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

PENDING = "pending"
STARTED = "started"
Expand Down
27 changes: 4 additions & 23 deletions morango/migrations/0001_squashed_0024_auto_20240129_1757.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# Generated by Django 3.2.24 on 2024-06-25 21:45
import datetime

import django.db.models.deletion
import django.db.models.manager
import django.utils.timezone
from django.db import migrations
from django.db import models
from django.utils.timezone import utc

import morango.models.fields.crypto
import morango.models.fields.uuids
Expand Down Expand Up @@ -129,9 +126,6 @@ class Migration(migrations.Migration):
(
"source_id",
models.CharField(
default=datetime.datetime(
2017, 10, 18, 21, 15, 6, 842850, tzinfo=utc
),
max_length=96,
),
),
Expand Down Expand Up @@ -166,17 +160,13 @@ class Migration(migrations.Migration):
(
"connection_kind",
models.CharField(
choices=[("network", "Network"), ("disk", "Disk")],
default="",
choices=[('network', 'Network'), ('disk', 'Disk')],
max_length=10,
),
),
(
"connection_path",
models.CharField(
default=datetime.datetime(
2017, 10, 18, 21, 15, 21, 147686, tzinfo=utc
),
max_length=1000,
),
),
Expand All @@ -186,9 +176,6 @@ class Migration(migrations.Migration):
(
"profile",
models.CharField(
default=datetime.datetime(
2017, 10, 18, 21, 15, 27, 811735, tzinfo=utc
),
max_length=40,
),
),
Expand Down Expand Up @@ -220,9 +207,6 @@ class Migration(migrations.Migration):
"last_activity_timestamp",
models.DateTimeField(
blank=True,
default=datetime.datetime(
2017, 10, 18, 21, 15, 30, 154629, tzinfo=utc
),
),
),
("client_fsic", models.TextField(blank=True, default="{}")),
Expand Down Expand Up @@ -338,10 +322,10 @@ class Migration(migrations.Migration):
"private_key",
morango.models.fields.crypto.PrivateKeyField(blank=True, null=True),
),
("lft", models.PositiveIntegerField(db_index=True, editable=False)),
("rght", models.PositiveIntegerField(db_index=True, editable=False)),
("lft", models.PositiveIntegerField(editable=False)),
("rght", models.PositiveIntegerField(editable=False)),
("tree_id", models.PositiveIntegerField(db_index=True, editable=False)),
("level", models.PositiveIntegerField(db_index=True, editable=False)),
("level", models.PositiveIntegerField(editable=False)),
(
"parent",
models.ForeignKey(
Expand Down Expand Up @@ -550,9 +534,6 @@ class Migration(migrations.Migration):
(
"source_id",
models.CharField(
default=datetime.datetime(
2017, 10, 18, 21, 13, 11, 488565, tzinfo=utc
),
max_length=96,
),
),
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
testpaths = tests/ morango/
DJANGO_SETTINGS_MODULE = testapp.settings
norecursedirs = dist tmp* .svn .*
markers =
windows: mark a test as a windows test
6 changes: 2 additions & 4 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# These are for testing
factory-boy==2.7.0
fake-factory==0.5.7
coverage==4.5.1
mock==2.0.0
pytest==3.10.1
pytest-cov==2.8.1
pytest-django==3.8.0
pytest==6.2.5
pytest-django==4.5.2
more-itertools<=8.10.0
typing
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
],
python_requires=">=3.6, <3.12",
python_requires=">=3.6, <3.13",
)
57 changes: 0 additions & 57 deletions tests/patch_pytest.py

This file was deleted.

38 changes: 0 additions & 38 deletions tests/pytest_3.10.patch

This file was deleted.

4 changes: 1 addition & 3 deletions tests/testapp/tests/test_uuid_utilities.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import hashlib
import sys
import uuid

import mock
Expand Down Expand Up @@ -100,6 +99,7 @@ def test_same_node_id(self):
@mock.patch("platform.platform", return_value="Windows 3.1")
@mock.patch("platform.node", return_value="myhost")
@mock.patch("morango.models.utils._get_database_path", return_value="<dummypath>")
@mock.patch('sys.version', '2.7.333')
def test_consistent_with_0_4_instance_id_calculation(self, *args):
"""
This test ensures that we don't accidentally make changes that impact how we calculate
Expand All @@ -108,8 +108,6 @@ def test_consistent_with_0_4_instance_id_calculation(self, *args):

from morango.models.utils import _get_database_path

sys.version = "2.7.333"

DatabaseIDModel.objects.all().update(current=False)
database_id = DatabaseIDModel.objects.create(
id="6fe445b75cea11858c00fb97bdee8878", current=True
Expand Down
14 changes: 6 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{3.6,3.7,3.8,3.9,3.10,3.11}-cryptography{40.0.2}
py{3.6,3.7,3.8,3.9,3.10,3.11,3.12}-cryptography{40.0.2}
postgres
windows

Expand All @@ -19,16 +19,16 @@ basepython =
py3.9: python3.9
py3.10: python3.10
py3.11: python3.11
py3.12: python3.12
postgres: python3.9
windows: python3.8

deps =
-r{toxinidir}/requirements/test.txt
cryptography40.0.2: cryptography==40.0.2
commands =
sh -c '! tests/testapp/manage.py makemigrations --dry-run --exit --noinput'
python tests/patch_pytest.py
python -O -m pytest {posargs:--cov=morango --color=no}
sh -c 'tests/testapp/manage.py makemigrations --check'
python -O -m pytest {posargs: --color=no}

[testenv:postgres]
deps =
Expand All @@ -38,14 +38,12 @@ setenv =
PYTHONPATH = {toxinidir}:{toxinidir}/tests/testapp
DJANGO_SETTINGS_MODULE = testapp.postgres_settings
commands =
python tests/patch_pytest.py
python -O -m pytest {posargs:--cov=morango --color=no}
python -O -m pytest {posargs: --color=no}

[testenv:windows]
deps =
-r{toxinidir}/requirements/test.txt
setenv =
PYTHONPATH = {toxinidir}{:}{toxinidir}/tests/testapp
commands =
python tests/patch_pytest.py
python -O -m pytest {posargs:--cov=morango --color=no} -m windows
python -O -m pytest {posargs: --color=no} -m windows

0 comments on commit 03fec46

Please sign in to comment.