Skip to content

Refactor/py312 compat - #898

Closed
prathamesh920 wants to merge 2 commits into
FOSSEE:masterfrom
prathamesh920:refactor/py312-compat
Closed

prathamesh920 wants to merge 2 commits into
FOSSEE:masterfrom
prathamesh920:refactor/py312-compat

Conversation

@prathamesh920

Copy link
Copy Markdown
Contributor

No description provided.

django.conf.urls.ur() was deprecated in Django in 3.1 and removed in
Django 4.0.
re_path() is the same function under its new name, so every URL pattern
is unchanged.
length_is was deprecated in Django 4.2 and removed in 5.1.
distutils was removed in Python 3.12. shutil.copytree with
dirs_exist_ok=True and shutil.copy2 do what distutils' copy_tree and
copy_file did: copy into an existing folder, overwrite files, keep
modes and times.

nose is unmaintained and does not import on Python 3.12+ (it uses the
removed 'imp' module). Python test cases get 'from nose.tools import *'
in their scope, so existing questions use assert_equal, ok_, eq_ etc.

yaksh/nose_tools.py builds the same names the same way nose did (each
unittest.TestCase.assertXxx as assert_xxx, plus ok_ and eq_), so the
names and assertion messages are unchanged. It also keeps the aliases
unittest removed in 3.12 (assert_equals, assert_regexp_matches,
assert_dict_contains_subset, ...).
If nose itself cannot be imported, test cases that import it explicitly
('from nose.tools import assert_equal') get this module instead.
nose stays in the requirements for now; will remove it with the Python 3.12
upgrade.

ruamel.yaml 0.18 removed the old module-level functions
(round_trip_dump, safe_load_all, safe_dump_all). The YAML() object API
does the same and already exists in the pinned 0.16.10:

Comparing to a literal with 'is' is a SyntaxWarning and not guaranteed to work.
raw string for the tag-split regex (same pattern).
Tests: assertEquals -> assertEqual (alias removed in Python 3.12).

Test nose-style test cases against yaksh/nose_tools.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant