Skip to content

{CI} Optimize the extension test: Use azdev test for testing, consistent with the main repo#5925

Merged
wangzelin007 merged 3 commits into
Azure:mainfrom
wangzelin007:refine-extension-test
Mar 15, 2023
Merged

{CI} Optimize the extension test: Use azdev test for testing, consistent with the main repo#5925
wangzelin007 merged 3 commits into
Azure:mainfrom
wangzelin007:refine-extension-test

Conversation

@wangzelin007
Copy link
Copy Markdown
Member

@wangzelin007 wangzelin007 commented Feb 24, 2023

The old test uses python unittest, and the test log is as follows:
image
The new test uses azdev test, and the test log is as follows:
image

@ghost ghost added Auto-Assign Auto assign by bot CI labels Feb 24, 2023
@ghost ghost requested review from bebound, jiasli, jsntcy, kairu-ms and yonzhan February 24, 2023 06:50
@wangzelin007 wangzelin007 changed the title {CI} Optimize the extension test: Use azdev test for testing, consistent with the main repo {CI} Optimize the extension test: Use azdev test for testing, consistent with the main repo Feb 24, 2023
@ghost ghost assigned wangzelin007 Feb 24, 2023
@ghost ghost added this to the Feb 2023 (2023-03-07) milestone Feb 24, 2023
@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Feb 24, 2023

CI

Comment thread scripts/ci/test_source.py
f'ALL_TESTS: {ALL_TESTS}.')


class TestExtensionSourceMeta(type):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention of this metaclass is to add test methods to TestExtensionSource during the initialization of TestExtensionSource.

To verify that, we can add print(TestExtensionSource.__dict__.keys()) to L97 and check the output:

dict_keys(['__module__', 'setUp', 'tearDown', 'test_azext_account', 'test_azext_acrtransfer', 'test_azext_ad', 'test_azext_adp', 'test_azext_aem', 'test_azext_ai_examples', 'test_azext_aks_preview', 'test_azext_alertsmanagement', 

It generates a bunch of methods starting with test_ for each extension so that unittest can run them one by one.

Question is: what is the point of it, when it can simply be replaced by a for loop and invoke unittest or pytest on one extension in each iteration?

Comment thread scripts/ci/test_source.py Outdated
@wangzelin007 wangzelin007 merged commit 4d330ce into Azure:main Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants