From fac3dd7f390d372736e05974cc5c3ef1a3768fbb Mon Sep 17 00:00:00 2001 From: David Smith <39445562+smithdc1@users.noreply.github.com> Date: Sat, 19 Feb 2022 19:36:01 +0000 Subject: [PATCH] Refs #33173 -- Fixed MailTests.test_backend_arg() on Windows and Python 3.11+. --- django/utils/version.py | 1 + tests/mail/tests.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/django/utils/version.py b/django/utils/version.py index 1e20a86563..5b6a435b51 100644 --- a/django/utils/version.py +++ b/django/utils/version.py @@ -15,6 +15,7 @@ PY37 = sys.version_info >= (3, 7) PY38 = sys.version_info >= (3, 8) PY39 = sys.version_info >= (3, 9) PY310 = sys.version_info >= (3, 10) +PY311 = sys.version_info >= (3, 11) def get_version(version=None): diff --git a/tests/mail/tests.py b/tests/mail/tests.py index 51e26cc6be..183a0c0ab1 100644 --- a/tests/mail/tests.py +++ b/tests/mail/tests.py @@ -29,6 +29,7 @@ from django.core.mail.message import BadHeaderError, sanitize_address from django.test import SimpleTestCase, override_settings from django.test.utils import requires_tz_support from django.utils.translation import gettext_lazy +from django.utils.version import PY311 try: from aiosmtpd.controller import Controller @@ -790,7 +791,7 @@ class MailTests(HeadersCheckMixin, SimpleTestCase): filebased.EmailBackend, ) - if sys.platform == "win32": + if sys.platform == "win32" and not PY311: msg = ( "_getfullpathname: path should be string, bytes or os.PathLike, not " "object"