Skip to content
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

Always return dictionary from tests #22799

Merged
merged 2 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ async def combined_call(*args, **kwargs):
test_output = None
try:
try:
test_output = await test_func(*args, variables=variables, **trimmed_kwargs)
# tests don't record successfully unless test_output is a dictionary
test_output = await test_func(*args, variables=variables, **trimmed_kwargs) or {}
tjprescott marked this conversation as resolved.
Show resolved Hide resolved
except TypeError:
logger = logging.getLogger()
logger.info(
"This test can't accept variables as input. The test method should accept `**kwargs` and/or a "
"`variables` parameter to make use of recorded test variables."
)
test_output = await test_func(*args, **trimmed_kwargs)
test_output = await test_func(*args, **trimmed_kwargs) or {}
except ResourceNotFoundError as error:
error_body = ContentDecodePolicy.deserialize_from_http_generics(error.response)
message = error_body.get("message") or error_body.get("Message")
Expand Down
5 changes: 3 additions & 2 deletions tools/azure-sdk-tools/devtools_testutils/proxy_testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,15 @@ def combined_call(*args, **kwargs):
test_output = None
try:
try:
test_output = test_func(*args, variables=variables, **trimmed_kwargs)
# tests don't record successfully unless test_output is a dictionary
test_output = test_func(*args, variables=variables, **trimmed_kwargs) or {}
except TypeError:
logger = logging.getLogger()
logger.info(
"This test can't accept variables as input. The test method should accept `**kwargs` and/or a "
"`variables` parameter to make use of recorded test variables."
)
test_output = test_func(*args, **trimmed_kwargs)
test_output = test_func(*args, **trimmed_kwargs) or {}
except ResourceNotFoundError as error:
error_body = ContentDecodePolicy.deserialize_from_http_generics(error.response)
message = error_body.get("message") or error_body.get("Message")
Expand Down