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

[test generation] optimize for "api-version" in generated tests #2798

Open
msyyc opened this issue Aug 27, 2024 · 5 comments
Open

[test generation] optimize for "api-version" in generated tests #2798

msyyc opened this issue Aug 27, 2024 · 5 comments
Assignees

Comments

@msyyc
Copy link
Member

msyyc commented Aug 27, 2024

"api-version" is usually client-level signature so no need to set it in specific:
https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_operations.py#L25
image

@msyyc msyyc self-assigned this Aug 27, 2024
@Azure Azure deleted a comment Aug 27, 2024
@Azure Azure deleted a comment Aug 27, 2024
@Azure Azure deleted a comment Aug 27, 2024
@Azure Azure deleted a comment Aug 27, 2024
@iscai-msft
Copy link
Contributor

method-level should override client-level though, I'm not sure what this issue is opened for, can you clarify @msyyc? Thanks!

@msyyc
Copy link
Member Author

msyyc commented Aug 28, 2024

api_version is already client level signature, so there is no need to set it when call specific method. The expected generated test shall be like:

    @recorded_by_proxy
    def test_list(self, resource_group):
        response = self.client.operations.list()
        result = [r for r in response]
        # please add some check logic here by yourself
        # ...

@iscai-msft
Copy link
Contributor

We still have the ability on the method-level to override the api-version, because let's say we initialize our client with an api-version that works for most methods, but for a specific method, we want to modify the api-version, so this I believe can have method-level overrides

@msyyc msyyc changed the title [test generation] optimize for "api-version" [test generation] optimize for "api-version" in generated tests Sep 3, 2024
@msyyc
Copy link
Member Author

msyyc commented Sep 5, 2024

Of course python permit users to override api-version when call method. In test generation, we don't want to show it since users may copy the generated test to tests folder for live test then it actually only test the specific api-version instead of default api-version if devs forget to update the test cases which brings some risks.

@iscai-msft
Copy link
Contributor

ah I see, ok that makes sense. Thanks for describing @msyyc!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants