Skip to content

Commit

Permalink
Edits to test documentation (Azure#16179)
Browse files Browse the repository at this point in the history
* swathis suggestions

* Update doc/dev/tests.md

Co-authored-by: swathipil <76007337+swathipil@users.noreply.github.com>

Co-authored-by: swathipil <76007337+swathipil@users.noreply.github.com>
  • Loading branch information
seankane-msft and swathipil authored Jan 14, 2021
1 parent 4f7fb0c commit ab7d89e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions doc/dev/mgmt/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ sdk/storage/azure-mgmt-storage> pytest

You can provide directories or individual files as positional arguments to specify particular tests to run rather than running the entire test suite. For example:
```Shell
sdk/storage/azure-mgmt-storage> pytest sdk/storage/azure-mgmt-storage/
sdk/storage/azure-mgmt-storage> pytest sdk/storage/azure-mgmt-storage/tests/test_mgmt_storage.py
sdk/storage/azure-mgmt-storage> pytest
sdk/storage/azure-mgmt-storage> pytest tests/test_mgmt_storage.py
```

If you have print statements in your tests for debugging you can add the `-s` flag to send those print statements to standard output:
```Shell
sdk/storage/azure-mgmt-storage> pytest sdk/storage/azure-mgmt-storage/ -s
sdk/storage/azure-mgmt-storage> pytest -s
```

## Getting Azure credentials
Expand Down Expand Up @@ -106,6 +106,7 @@ def get_credentials(**kwargs):
```python
def get_azure_core_credentials(**kwargs):
from azure.identity import ClientSecretCredential
import os
return ClientSecretCredential(
client_id = os.environ['AZURE_CLIENT_ID'],
client_secret = os.environ['AZURE_CLIENT_SECRET'],
Expand Down
8 changes: 7 additions & 1 deletion doc/dev/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ azure-sdk-for-python\sdk\my-directory\my-library> pytest
azure-sdk-for-python\sdk\my-directory\my-library> pytest <test_file.py>
```

If your tests are broken up into multiple folders for organization, you can run specific folders:
```cmd
azure-sdk-for-python\sdk\my-directory\my-library> pytest .\tests\async_tests\
azure-sdk-for-python\sdk\my-directory\my-library> pytest .\tests\async_tests\<test_file.py>
```

In addition you can provide keywords to run specific tests within the suite or within a specific file
```cmd
azure-sdk-for-python\sdk\my-directory\my-library> pytest -k <keyword>
Expand Down Expand Up @@ -293,4 +299,4 @@ For more information, refer to the [advanced tests notes][advanced_tests_notes]
[azure_devtools]: https://pypi.org/project/azure-devtools/
[engsys_wiki]: https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/48/Create-a-new-Live-Test-pipeline?anchor=test-resources.json
[mgmt_settings_fake]: https://github.com/Azure/azure-sdk-for-python/blob/master/tools/azure-sdk-tools/devtools_testutils/mgmt_settings_fake.py
[packaging]: ./packaging.md
[packaging]: ./packaging.md

0 comments on commit ab7d89e

Please sign in to comment.