Skip to content
Snippets Groups Projects
Commit 8a5e69ad authored by Nilesh Patra's avatar Nilesh Patra
Browse files

Cherry-pick upstream patch to fix FTBFS with python3.11 (Closes: #1026586)

parent 08f2f2f5
No related branches found
No related tags found
No related merge requests found
From 2ff28a51439ec687be687f9b3d204316e60cabcd Mon Sep 17 00:00:00 2001
From: Georg Sauthoff <mail@gms.tf>
Date: Sat, 9 Jul 2022 17:22:55 +0200
Subject: [PATCH] Also patch pathlib expanduser
NB: with recent Python versions the existing `os.path.expanduser()` patch
also affects `pathlib.path.expanduser()` which is invoked by the config
parser for expanding `~/.ssh`.
---
tests/test_config.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/test_config.py b/tests/test_config.py
index 31f055ec..ce3083e3 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -417,8 +417,12 @@ def mock_expanduser(path):
return path
+ def mock_pathlib_expanduser(s):
+ return s._from_parts([os.environ['HOME']] + s._parts[1:])
+
with self.assertRaises(asyncssh.ConfigParseError):
- with patch('os.path.expanduser', mock_expanduser):
+ with patch('os.path.expanduser', mock_expanduser), \
+ patch('pathlib.Path.expanduser', mock_pathlib_expanduser):
self._parse_config('RemoteCommand %d')
def test_uid_percent_expansion_unavailable(self):
......@@ -2,3 +2,4 @@ sphinx-use-default-theme.patch
0002-skip-tests-requiring-network-access.patch
0003-Revert-fido-0.9.2-support.patch
0004-Handle-ConnectionRefusedError-when-connecting-to-223.patch
mock-pathlib-expanduser.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment