Skip to content

[Cosmos] migrate from using unittest - #32076

Merged
simorenoh merged 60 commits into
Azure:mainfrom
simorenoh:update-tests
Oct 17, 2023
Merged

[Cosmos] migrate from using unittest#32076
simorenoh merged 60 commits into
Azure:mainfrom
simorenoh:update-tests

Conversation

@simorenoh

@simorenoh simorenoh commented Sep 13, 2023

Copy link
Copy Markdown
Member

It seems as though our Cosmos async client tests are actually not running in the pipelines:
image
image

This is due to the fact that using the unit test package does not support async, and as such we have been missing coverage for a while. Most other SDKs are actually not even using unit test anymore since the new test proxy does not use it, so moving away from it in general should be the move. This PR takes care of migrating all of our existing tests to use the default pytest package, which should allow our pipelines to run async tests. This PR also fixes some tests.

I'll also be renaming the tests to have an async suffix at the end since otherwise it makes the debugging a bit rougher (from images above, you wouldn't know which is which if the time was the same.)

EDIT: This is what the pipeline looks like now, with both renaming and async tests actually running:
image

using this one as the test file
@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@azure-sdk

azure-sdk commented Sep 13, 2023

Copy link
Copy Markdown
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-cosmos

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh
simorenoh marked this pull request as ready for review October 2, 2023 20:49
Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/aio/_cosmos_client.py
Comment thread sdk/cosmos/azure-cosmos/test/test_query_async.py
Comment thread sdk/cosmos/azure-cosmos/test/test_query_async.py Outdated

@bambriz bambriz left a comment

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.

LGTM

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@kushagraThapar kushagraThapar left a comment

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.

Requesting change on the changelog update, others are just nit comments and are not blockers, thanks @simorenoh

Comment thread sdk/cosmos/azure-cosmos/CHANGELOG.md Outdated
Comment thread sdk/cosmos/azure-cosmos/test/test_auto_scale.py
Comment thread sdk/cosmos/azure-cosmos/test/test_auto_scale_async.py
Comment thread sdk/cosmos/azure-cosmos/test/test_crud_async.py
Comment thread sdk/cosmos/azure-cosmos/test/test_crud_async.py
Comment thread sdk/cosmos/azure-cosmos/dev_requirements.txt
@simorenoh
simorenoh merged commit e1df91b into Azure:main Oct 17, 2023
@simorenoh
simorenoh deleted the update-tests branch October 17, 2023 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants