-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Packaging] Support Python 3.11 #26923
Changes from 6 commits
edf18bd
e2852ec
d0421af
c5dec5a
f91ee23
db4341f
7a0c285
265fb6c
70a89dc
f2dc5e7
890df61
97beb14
ae79bd7
9532240
5a3d9f2
957f19b
0e92cb2
edea742
7e19a72
36d8dc4
87d3e90
952aac6
b5fedff
f4cf181
c8109ff
ba4951a
f87722c
f2baaba
6936dc5
8b7a8c3
d0887b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -160,10 +160,10 @@ def _mock_get_extension_modname(ext_name, ext_dir): | |||
return "azext_always_loaded" | ||||
|
||||
def _mock_get_extensions(): | ||||
MockExtension = namedtuple('Extension', ['name', 'preview', 'experimental', 'path', 'get_metadata']) | ||||
return [MockExtension(name=__name__ + '.ExtCommandsLoader', preview=False, experimental=False, path=None, get_metadata=lambda: {}), | ||||
MockExtension(name=__name__ + '.Ext2CommandsLoader', preview=False, experimental=False, path=None, get_metadata=lambda: {}), | ||||
MockExtension(name=__name__ + '.ExtAlwaysLoadedCommandsLoader', preview=False, experimental=False, path=None, get_metadata=lambda: {})] | ||||
MockExtension = namedtuple('Extension', ['name', 'preview', 'experimental', 'path', 'get_metadata', 'version', 'ext_type']) | ||||
return [MockExtension(name=__name__ + '.ExtCommandsLoader', preview=False, experimental=False, path=None, get_metadata=lambda: {}, version='0.0.1', ext_type='dev'), | ||||
MockExtension(name=__name__ + '.Ext2CommandsLoader', preview=False, experimental=False, path=None, get_metadata=lambda: {}, version='0.0.1', ext_type='dev'), | ||||
MockExtension(name=__name__ + '.ExtAlwaysLoadedCommandsLoader', preview=False, experimental=False, path=None, get_metadata=lambda: {}, version='0.0.1', ext_type='dev')] | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Fix stderr in "Unit Test for Core 3.11" when run
Error stack is:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why didn't this fail before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is a Captured log call, it does not affect the test result. I've reverted this change. |
||||
|
||||
def _mock_load_command_loader(loader, args, name, prefix): | ||||
|
||||
|
@@ -298,10 +298,10 @@ def _check_index(): | |||
loader.load_command_table(["hello", "mod-only"]) | ||||
_check_index() | ||||
|
||||
with mock.patch("azure.cli.core.__version__", "2.7.0"), mock.patch.object(cli.cloud, "profile", "2019-03-01-hybrid"): | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test fails in Python 3.11:
I found a similar issue scikit-hep/pyhf#2143. Switching to After further debugging
Git blaming
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great work, I have never considered that this error is related to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I figured this out. The actual cause is In 3.10, mock use its own In 3.11, it uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep this conversation open as a TODO item. I feel there should be a way to patch |
||||
with mock.patch.object(cli.cloud, "profile", "2019-03-01-hybrid"): | ||||
def update_and_check_index(): | ||||
loader.load_command_table(["hello", "mod-only"]) | ||||
self.assertEqual(INDEX[CommandIndex._COMMAND_INDEX_VERSION], "2.7.0") | ||||
self.assertEqual(INDEX[CommandIndex._COMMAND_INDEX_VERSION], __version__) | ||||
self.assertEqual(INDEX[CommandIndex._COMMAND_INDEX_CLOUD_PROFILE], "2019-03-01-hybrid") | ||||
self.assertDictEqual(INDEX[CommandIndex._COMMAND_INDEX], self.expected_command_index) | ||||
|
||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,7 @@ def trim_kwargs_from_test_function(fn, kwargs): | |
# the next function is the actual test function. the kwargs need to be trimmed so | ||
# that parameters which are not required will not be passed to it. | ||
if not is_preparer_func(fn): | ||
args, _, kw, _ = inspect.getargspec(fn) # pylint: disable=deprecated-method | ||
args, _, kw, *_ = inspect.getfullargspec(fn) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ref: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's time to drop A previous attempt was made by #24111. |
||
if kw is None: | ||
args = set(args) | ||
for key in [k for k in kwargs if k not in args]: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should drop Python 3.10 tests right away as the bundled Python is still 3.10.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bundled Python is also bumped in #26749