Refresh patches
This commit is contained in:
parent
0b7387327a
commit
57dc38673b
@ -38,14 +38,12 @@ Patch5003: Disable-test-that-calls-compat-code-removed-in-3.12.patch
|
|||||||
# Deprecations #
|
# Deprecations #
|
||||||
# ansible-test - Replace pytest-forked (#80525)
|
# ansible-test - Replace pytest-forked (#80525)
|
||||||
Patch6000: https://github.com/ansible/ansible/commit/676b731e6f7d60ce6fd48c0d1c883fc85f5c6537.patch#/ansible-test-replace-pytest-forked.patch
|
Patch6000: https://github.com/ansible/ansible/commit/676b731e6f7d60ce6fd48c0d1c883fc85f5c6537.patch#/ansible-test-replace-pytest-forked.patch
|
||||||
# ansible-test - Avoid use of deprecated utcnow (#80750)
|
|
||||||
Patch6001: https://github.com/ansible/ansible/commit/fd341265d001d4e6545ffb2b7d154340cb1f1931.patch#/avoid-use-of-deprecated-utcnow.patch
|
|
||||||
# urls - remove deprecated client key calls (#80751)
|
# urls - remove deprecated client key calls (#80751)
|
||||||
Patch6002: https://github.com/ansible/ansible/commit/0df794e5a4fe4597ee65b0d492fbf0d0989d5ca0.patch#/urls-remove-deprecated-client-key-calls.patch
|
Patch6002: https://github.com/ansible/ansible/commit/0df794e5a4fe4597ee65b0d492fbf0d0989d5ca0.patch#/urls-remove-deprecated-client-key-calls.patch
|
||||||
# replace deprecated ast.value.s with ast.value.value (#80968)
|
# replace deprecated ast.value.s with ast.value.value (#80968)
|
||||||
Patch6003: https://github.com/ansible/ansible/commit/742d47fa15a5418f98abf9aaf07edf466e871c81.patch#/replace-deprecated-ast.value.s.patch
|
Patch6003: https://github.com/ansible/ansible/commit/742d47fa15a5418f98abf9aaf07edf466e871c81.patch#/replace-deprecated-ast.value.s.patch
|
||||||
# Avoid deprecated importlib.abc.TraversableResources (#81082)
|
# Avoid deprecated importlib.abc.TraversableResources (#81082)
|
||||||
Patch6004: https://github.com/ansible/ansible/pull/81082.patch#/avoid-importlib-resources-abc-deprecation.patch
|
Patch6004: https://github.com/ansible/ansible/commit/bd5b0b4293f454819766437cb6f8a7037affd49e.patch#/avoid-importlib-resources-abc-deprecation.patch
|
||||||
|
|
||||||
Url: https://ansible.com
|
Url: https://ansible.com
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
@ -1,13 +1,28 @@
|
|||||||
From 2d84891781d6afb26fa5e3df1140602fa0fd7830 Mon Sep 17 00:00:00 2001
|
From bd5b0b4293f454819766437cb6f8a7037affd49e Mon Sep 17 00:00:00 2001
|
||||||
From: Maxwell G <maxwell@gtmx.me>
|
From: Maxwell G <maxwell@gtmx.me>
|
||||||
Date: Sat, 17 Jun 2023 17:35:41 +0000
|
Date: Tue, 20 Jun 2023 13:54:06 -0500
|
||||||
Subject: [PATCH] Avoid usage of deprecated importlib.abc.TraversableResources
|
Subject: [PATCH] Avoid deprecated importlib.abc.TraversableResources (#81082)
|
||||||
|
|
||||||
|
* Avoid usage of deprecated importlib.abc.TraversableResources
|
||||||
|
|
||||||
This fixes ansible-compat test failures with Python 3.12.
|
This fixes ansible-compat test failures with Python 3.12.
|
||||||
|
|
||||||
|
* Add deprecated: marker for compat code
|
||||||
|
|
||||||
|
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
|
||||||
|
|
||||||
|
* add declarative deprecation comment to < 3.9 case
|
||||||
|
|
||||||
|
Co-authored-by: Matt Clay <matt@mystile.com>
|
||||||
|
|
||||||
|
---------
|
||||||
|
|
||||||
|
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
|
||||||
|
Co-authored-by: Matt Clay <matt@mystile.com>
|
||||||
---
|
---
|
||||||
.../fragments/81082-deprecated-importlib-abc.yml | 5 +++++
|
.../fragments/81082-deprecated-importlib-abc.yml | 5 +++++
|
||||||
.../utils/collection_loader/_collection_finder.py | 12 +++++++++++-
|
.../utils/collection_loader/_collection_finder.py | 13 ++++++++++++-
|
||||||
2 files changed, 16 insertions(+), 1 deletion(-)
|
2 files changed, 17 insertions(+), 1 deletion(-)
|
||||||
create mode 100644 changelogs/fragments/81082-deprecated-importlib-abc.yml
|
create mode 100644 changelogs/fragments/81082-deprecated-importlib-abc.yml
|
||||||
|
|
||||||
diff --git a/changelogs/fragments/81082-deprecated-importlib-abc.yml b/changelogs/fragments/81082-deprecated-importlib-abc.yml
|
diff --git a/changelogs/fragments/81082-deprecated-importlib-abc.yml b/changelogs/fragments/81082-deprecated-importlib-abc.yml
|
||||||
@ -22,10 +37,10 @@ index 00000000000000..6dfd90a16bed66
|
|||||||
+ ``importlib.abc.TraversableResources`` where available
|
+ ``importlib.abc.TraversableResources`` where available
|
||||||
+ (https:/github.com/ansible/ansible/pull/81082).
|
+ (https:/github.com/ansible/ansible/pull/81082).
|
||||||
diff --git a/lib/ansible/utils/collection_loader/_collection_finder.py b/lib/ansible/utils/collection_loader/_collection_finder.py
|
diff --git a/lib/ansible/utils/collection_loader/_collection_finder.py b/lib/ansible/utils/collection_loader/_collection_finder.py
|
||||||
index fc6744ffdef64e..edac8fa6f225b2 100644
|
index fc6744ffdef64e..16d0bcc6e8e92a 100644
|
||||||
--- a/lib/ansible/utils/collection_loader/_collection_finder.py
|
--- a/lib/ansible/utils/collection_loader/_collection_finder.py
|
||||||
+++ b/lib/ansible/utils/collection_loader/_collection_finder.py
|
+++ b/lib/ansible/utils/collection_loader/_collection_finder.py
|
||||||
@@ -40,8 +40,18 @@ def import_module(name): # type: ignore[misc]
|
@@ -40,8 +40,19 @@ def import_module(name): # type: ignore[misc]
|
||||||
reload_module = reload # type: ignore[name-defined] # pylint:disable=undefined-variable
|
reload_module = reload # type: ignore[name-defined] # pylint:disable=undefined-variable
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -39,9 +54,10 @@ index fc6744ffdef64e..edac8fa6f225b2 100644
|
|||||||
+ # Used with Python 3.9 and 3.10 only
|
+ # Used with Python 3.9 and 3.10 only
|
||||||
+ # This member is still available as an alias up until Python 3.14 but
|
+ # This member is still available as an alias up until Python 3.14 but
|
||||||
+ # is deprecated as of Python 3.12.
|
+ # is deprecated as of Python 3.12.
|
||||||
+ from importlib.abc import TraversableResources
|
+ from importlib.abc import TraversableResources # deprecated: description='TraversableResources move' python_version='3.10'
|
||||||
except ImportError:
|
except ImportError:
|
||||||
+ # Python < 3.9
|
+ # Python < 3.9
|
||||||
|
+ # deprecated: description='TraversableResources fallback' python_version='3.8'
|
||||||
TraversableResources = object # type: ignore[assignment,misc]
|
TraversableResources = object # type: ignore[assignment,misc]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -1,144 +0,0 @@
|
|||||||
From fd341265d001d4e6545ffb2b7d154340cb1f1931 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Matt Clay <matt@mystile.com>
|
|
||||||
Date: Wed, 10 May 2023 11:26:49 -0700
|
|
||||||
Subject: [PATCH] ansible-test - Avoid use of deprecated utcnow (#80750)
|
|
||||||
|
|
||||||
The timestamps are only used by ansible-test, not the junit callback, so this change only impacts ansible-test.
|
|
||||||
---
|
|
||||||
changelogs/fragments/ansible-test-utcnow.yml | 2 ++
|
|
||||||
lib/ansible/utils/_junit_xml.py | 6 +++++-
|
|
||||||
test/lib/ansible_test/_internal/commands/env/__init__.py | 2 +-
|
|
||||||
.../_internal/commands/integration/__init__.py | 2 +-
|
|
||||||
.../_internal/commands/integration/cloud/__init__.py | 2 +-
|
|
||||||
test/lib/ansible_test/_internal/commands/sanity/pylint.py | 8 ++++----
|
|
||||||
test/lib/ansible_test/_internal/test.py | 6 ++----
|
|
||||||
7 files changed, 16 insertions(+), 12 deletions(-)
|
|
||||||
create mode 100644 changelogs/fragments/ansible-test-utcnow.yml
|
|
||||||
|
|
||||||
diff --git a/changelogs/fragments/ansible-test-utcnow.yml b/changelogs/fragments/ansible-test-utcnow.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 00000000000000..0781a0cb48a1f8
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/changelogs/fragments/ansible-test-utcnow.yml
|
|
||||||
@@ -0,0 +1,2 @@
|
|
||||||
+minor_changes:
|
|
||||||
+ - ansible-test - Use ``datetime.datetime.now`` with ``tz`` specified instead of ``datetime.datetime.utcnow``.
|
|
||||||
diff --git a/lib/ansible/utils/_junit_xml.py b/lib/ansible/utils/_junit_xml.py
|
|
||||||
index 6b7c80f4cdf2de..8c4dba013edcb7 100644
|
|
||||||
--- a/lib/ansible/utils/_junit_xml.py
|
|
||||||
+++ b/lib/ansible/utils/_junit_xml.py
|
|
||||||
@@ -144,6 +144,10 @@ class TestSuite:
|
|
||||||
system_out: str | None = None
|
|
||||||
system_err: str | None = None
|
|
||||||
|
|
||||||
+ def __post_init__(self):
|
|
||||||
+ if self.timestamp and self.timestamp.tzinfo != datetime.timezone.utc:
|
|
||||||
+ raise ValueError(f'timestamp.tzinfo must be {datetime.timezone.utc!r}')
|
|
||||||
+
|
|
||||||
@property
|
|
||||||
def disabled(self) -> int:
|
|
||||||
"""The number of disabled test cases."""
|
|
||||||
@@ -187,7 +191,7 @@ def get_attributes(self) -> dict[str, str]:
|
|
||||||
skipped=self.skipped,
|
|
||||||
tests=self.tests,
|
|
||||||
time=self.time,
|
|
||||||
- timestamp=self.timestamp.isoformat(timespec='seconds') if self.timestamp else None,
|
|
||||||
+ timestamp=self.timestamp.replace(tzinfo=None).isoformat(timespec='seconds') if self.timestamp else None,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_xml_element(self) -> ET.Element:
|
|
||||||
diff --git a/test/lib/ansible_test/_internal/commands/env/__init__.py b/test/lib/ansible_test/_internal/commands/env/__init__.py
|
|
||||||
index 44f229f87999d7..6c0510566a052e 100644
|
|
||||||
--- a/test/lib/ansible_test/_internal/commands/env/__init__.py
|
|
||||||
+++ b/test/lib/ansible_test/_internal/commands/env/__init__.py
|
|
||||||
@@ -85,7 +85,7 @@ def show_dump_env(args: EnvConfig) -> None:
|
|
||||||
),
|
|
||||||
git=get_ci_provider().get_git_details(args),
|
|
||||||
platform=dict(
|
|
||||||
- datetime=datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ'),
|
|
||||||
+ datetime=datetime.datetime.now(tz=datetime.timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ'),
|
|
||||||
platform=platform.platform(),
|
|
||||||
uname=platform.uname(),
|
|
||||||
),
|
|
||||||
diff --git a/test/lib/ansible_test/_internal/commands/integration/__init__.py b/test/lib/ansible_test/_internal/commands/integration/__init__.py
|
|
||||||
index 0e5abbb6532193..5bd04407beeec5 100644
|
|
||||||
--- a/test/lib/ansible_test/_internal/commands/integration/__init__.py
|
|
||||||
+++ b/test/lib/ansible_test/_internal/commands/integration/__init__.py
|
|
||||||
@@ -566,7 +566,7 @@ def command_integration_filtered(
|
|
||||||
coverage_manager.teardown()
|
|
||||||
|
|
||||||
result_name = '%s-%s.json' % (
|
|
||||||
- args.command, re.sub(r'[^0-9]', '-', str(datetime.datetime.utcnow().replace(microsecond=0))))
|
|
||||||
+ args.command, re.sub(r'[^0-9]', '-', str(datetime.datetime.now(tz=datetime.timezone.utc).replace(microsecond=0, tzinfo=None))))
|
|
||||||
|
|
||||||
data = dict(
|
|
||||||
targets=results,
|
|
||||||
diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/__init__.py b/test/lib/ansible_test/_internal/commands/integration/cloud/__init__.py
|
|
||||||
index cad84a368924b2..eac9265a4f8c53 100644
|
|
||||||
--- a/test/lib/ansible_test/_internal/commands/integration/cloud/__init__.py
|
|
||||||
+++ b/test/lib/ansible_test/_internal/commands/integration/cloud/__init__.py
|
|
||||||
@@ -170,7 +170,7 @@ def cloud_init(args: IntegrationConfig, targets: tuple[IntegrationTarget, ...])
|
|
||||||
|
|
||||||
if not args.explain and results:
|
|
||||||
result_name = '%s-%s.json' % (
|
|
||||||
- args.command, re.sub(r'[^0-9]', '-', str(datetime.datetime.utcnow().replace(microsecond=0))))
|
|
||||||
+ args.command, re.sub(r'[^0-9]', '-', str(datetime.datetime.now(tz=datetime.timezone.utc).replace(microsecond=0, tzinfo=None))))
|
|
||||||
|
|
||||||
data = dict(
|
|
||||||
clouds=results,
|
|
||||||
diff --git a/test/lib/ansible_test/_internal/commands/sanity/pylint.py b/test/lib/ansible_test/_internal/commands/sanity/pylint.py
|
|
||||||
index fe5fbac9522fef..c089f834e50f89 100644
|
|
||||||
--- a/test/lib/ansible_test/_internal/commands/sanity/pylint.py
|
|
||||||
+++ b/test/lib/ansible_test/_internal/commands/sanity/pylint.py
|
|
||||||
@@ -156,19 +156,19 @@ def context_filter(path_to_filter: str) -> bool:
|
|
||||||
except CollectionDetailError as ex:
|
|
||||||
display.warning('Skipping pylint collection version checks since collection detail loading failed: %s' % ex.reason)
|
|
||||||
|
|
||||||
- test_start = datetime.datetime.utcnow()
|
|
||||||
+ test_start = datetime.datetime.now(tz=datetime.timezone.utc)
|
|
||||||
|
|
||||||
for context, context_paths in sorted(contexts):
|
|
||||||
if not context_paths:
|
|
||||||
continue
|
|
||||||
|
|
||||||
- context_start = datetime.datetime.utcnow()
|
|
||||||
+ context_start = datetime.datetime.now(tz=datetime.timezone.utc)
|
|
||||||
messages += self.pylint(args, context, context_paths, plugin_dir, plugin_names, python, collection_detail)
|
|
||||||
- context_end = datetime.datetime.utcnow()
|
|
||||||
+ context_end = datetime.datetime.now(tz=datetime.timezone.utc)
|
|
||||||
|
|
||||||
context_times.append('%s: %d (%s)' % (context, len(context_paths), context_end - context_start))
|
|
||||||
|
|
||||||
- test_end = datetime.datetime.utcnow()
|
|
||||||
+ test_end = datetime.datetime.now(tz=datetime.timezone.utc)
|
|
||||||
|
|
||||||
for context_time in context_times:
|
|
||||||
display.info(context_time, verbosity=4)
|
|
||||||
diff --git a/test/lib/ansible_test/_internal/test.py b/test/lib/ansible_test/_internal/test.py
|
|
||||||
index 4814ee3e25e525..fe5ef3f8d3472a 100644
|
|
||||||
--- a/test/lib/ansible_test/_internal/test.py
|
|
||||||
+++ b/test/lib/ansible_test/_internal/test.py
|
|
||||||
@@ -114,7 +114,7 @@ def save_junit(self, args: TestConfig, test_case: junit_xml.TestCase) -> None:
|
|
||||||
junit_xml.TestSuite(
|
|
||||||
name='ansible-test',
|
|
||||||
cases=[test_case],
|
|
||||||
- timestamp=datetime.datetime.utcnow(),
|
|
||||||
+ timestamp=datetime.datetime.now(tz=datetime.timezone.utc),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
@@ -153,13 +153,11 @@ def write(self, args: TestConfig) -> None:
|
|
||||||
|
|
||||||
output += '\n\nConsult the console log for additional details on where the timeout occurred.'
|
|
||||||
|
|
||||||
- timestamp = datetime.datetime.utcnow()
|
|
||||||
-
|
|
||||||
suites = junit_xml.TestSuites(
|
|
||||||
suites=[
|
|
||||||
junit_xml.TestSuite(
|
|
||||||
name='ansible-test',
|
|
||||||
- timestamp=timestamp,
|
|
||||||
+ timestamp=datetime.datetime.now(tz=datetime.timezone.utc),
|
|
||||||
cases=[
|
|
||||||
junit_xml.TestCase(
|
|
||||||
name='timeout',
|
|
Loading…
Reference in New Issue
Block a user