Skip to content

Commit

Permalink
build: update tox_moderniser for python312 support
Browse files Browse the repository at this point in the history
  • Loading branch information
UsamaSadiq committed Feb 15, 2024
1 parent 01cee3f commit a06e1ea
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion edx_repo_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

__version__ = '0.8.2'
__version__ = '0.8.3'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def is_requirement(line):
'modernize_node_workflow = edx_repo_tools.codemods.node16.gha_ci_modernizer:main',
'modernize_openedx_yaml = edx_repo_tools.modernize_openedx_yaml:main',
'modernize_setup_file = edx_repo_tools.codemods.django3.setup_file_modernizer:main',
'modernize_tox = edx_repo_tools.codemods.django3.tox_modernizer:main',
'modernize_tox = edx_repo_tools.codemods.python312.tox_modernizer:main',
'modernize_travis = edx_repo_tools.codemods.django3.travis_modernizer:main',
'no_yaml = edx_repo_tools.ospr.no_yaml:no_yaml',
'oep2 = edx_repo_tools.oep2:_cli',
Expand Down
8 changes: 3 additions & 5 deletions tests/sample_tox_config.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{27,35,36,37}-django{111,20,21,22}-drf{39,310,latest},
py{38}-django{32,40}-drf{39,310,latest},
docs,
quality,
version_check,
Expand All @@ -9,10 +9,8 @@ envlist =

[testenv]
deps =
django111: Django>=1.11,<2.0
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django22: Django>=2.2,<2.3
django32: Django>=3.2,<3.3
django40: Django>=4.0,<4.1
drf39: djangorestframework<3.10.0
drf310: djangorestframework<3.11.0
drflatest: djangorestframework
Expand Down
8 changes: 3 additions & 5 deletions tests/sample_tox_config_2.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py27,py35,py36,py37-django111,django20,django21,django22-drf39,drf310,drflatest,
py37,py38-django32,django40-drf39,drf310,drflatest,
docs,
quality,
version_check,
Expand All @@ -9,10 +9,8 @@ envlist =

[testenv]
deps =
django111: Django>=1.11,<2.0
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django22: Django>=2.2,<2.3
django32: Django>=3.2,<3.3
django40: Django>=4.0,<4.1
drf39: djangorestframework<3.10.0
drf310: djangorestframework<3.11.0
drflatest: djangorestframework
Expand Down
16 changes: 5 additions & 11 deletions tests/test_tox_modernizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,21 @@ def _assert_django_dependencies_replaced(self, config_file):
parser = self._get_parser(config_file)
dependencies = parser['testenv']['deps']

self.assertIn("django32:", dependencies)
self.assertIn("django40:", dependencies)
self.assertNotIn("django32:", dependencies)
self.assertIn("django42:", dependencies)

def _assert_replaces_python_interpreters(self, config_file):
parser = self._get_parser(config_file)
env_list = parser['tox']['envlist']

self.assertNotRegex("py{27}", env_list)
self.assertNotIn("py{27,35}", env_list)
self.assertNotIn("py{27,35,36}", env_list)
self.assertNotIn("py{27,35,36,37}", env_list)
self.assertIn("py38", env_list)
self.assertIn("py312", env_list)

def _assert_replaces_django_runners(self, config_file):
parser = self._get_parser(config_file)
env_list = parser['tox']['envlist']

self.assertNotIn("django{111}", env_list)
self.assertNotIn("django{111,20}", env_list)
self.assertNotIn("django{111,20,21}", env_list)
self.assertIn("django{32,40}", env_list)
self.assertIn("django{42}", env_list)

def _assert_replaces_django_dependencies(self, config_file):
self._assert_django_dependencies_replaced(config_file)
Expand All @@ -63,7 +57,7 @@ def _assert_adds_django_dependencies(self, config_file):
parser.read(config_file)

dependencies = parser['testenv']['deps']
dependencies = re.sub("[^\n]*django32.*\n", '', dependencies)
dependencies = re.sub("[^\n]*django42.*\n", '', dependencies)
parser['testenv']['deps'] = dependencies

with open(config_file, 'w') as configfile:
Expand Down

0 comments on commit a06e1ea

Please sign in to comment.