File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
sdk/compute/azure-mgmt-compute/tests
tools/azure-sdk-tools/packaging_tools/templates/multiapi_combiner Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ def test_api_version(self):
2525 # expect to raise error when method signatue is not supported for the api version
2626 client = self .client (api_version = "2016-04-30-preview" )
2727 signature = inspect .signature (client .availability_sets .list_by_subscription )
28- assert not ("expand" in signature .parameters .keys ())
29-
30-
28+ result = "expand" in signature .parameters .keys ()
29+ try :
30+ # old package structure
31+ assert result == False
32+ except AssertionError :
33+ # new package structure
34+ with pytest .raises (ValueError ):
35+ client .availability_sets .list_by_subscription (expand = "fake_expand" )
Original file line number Diff line number Diff line change @@ -16,11 +16,12 @@ def api_version_validation(**kwargs):
1616 def wrapper(*args, **kwargs):
1717 func_name = func.__name__
1818 try:
19+ client = args[0]
1920 client_api_version = client._get_api_version(func_name) # pylint: disable=protected-access
2021 except AttributeError:
21- client_api_version = client._api_version
22+ client_api_version = client._api_version # pylint: disable=protected-access
2223
23- if client_api_version not in method_valid_on:
24+ if method_valid_on and client_api_version not in method_valid_on:
2425 raise ValueError(
2526 f"'{func_name}' is not available in API version "
2627 f"{client_api_version}. All valid API version are {', '.join(method_valid_on)}."
You can’t perform that action at this time.
0 commit comments