Skip to content

Commit ab7d89e

Browse files
Edits to test documentation (#16179)
* swathis suggestions * Update doc/dev/tests.md Co-authored-by: swathipil <[email protected]> Co-authored-by: swathipil <[email protected]>
1 parent 4f7fb0c commit ab7d89e

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

doc/dev/mgmt/tests.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ sdk/storage/azure-mgmt-storage> pytest
3535

3636
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:
3737
```Shell
38-
sdk/storage/azure-mgmt-storage> pytest sdk/storage/azure-mgmt-storage/
39-
sdk/storage/azure-mgmt-storage> pytest sdk/storage/azure-mgmt-storage/tests/test_mgmt_storage.py
38+
sdk/storage/azure-mgmt-storage> pytest
39+
sdk/storage/azure-mgmt-storage> pytest tests/test_mgmt_storage.py
4040
```
4141

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

4747
## Getting Azure credentials
@@ -106,6 +106,7 @@ def get_credentials(**kwargs):
106106
```python
107107
def get_azure_core_credentials(**kwargs):
108108
from azure.identity import ClientSecretCredential
109+
import os
109110
return ClientSecretCredential(
110111
client_id = os.environ['AZURE_CLIENT_ID'],
111112
client_secret = os.environ['AZURE_CLIENT_SECRET'],

doc/dev/tests.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ azure-sdk-for-python\sdk\my-directory\my-library> pytest
8484
azure-sdk-for-python\sdk\my-directory\my-library> pytest <test_file.py>
8585
```
8686

87+
If your tests are broken up into multiple folders for organization, you can run specific folders:
88+
```cmd
89+
azure-sdk-for-python\sdk\my-directory\my-library> pytest .\tests\async_tests\
90+
azure-sdk-for-python\sdk\my-directory\my-library> pytest .\tests\async_tests\<test_file.py>
91+
```
92+
8793
In addition you can provide keywords to run specific tests within the suite or within a specific file
8894
```cmd
8995
azure-sdk-for-python\sdk\my-directory\my-library> pytest -k <keyword>
@@ -293,4 +299,4 @@ For more information, refer to the [advanced tests notes][advanced_tests_notes]
293299
[azure_devtools]: https://pypi.org/project/azure-devtools/
294300
[engsys_wiki]: https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/48/Create-a-new-Live-Test-pipeline?anchor=test-resources.json
295301
[mgmt_settings_fake]: https://github.com/Azure/azure-sdk-for-python/blob/master/tools/azure-sdk-tools/devtools_testutils/mgmt_settings_fake.py
296-
[packaging]: ./packaging.md
302+
[packaging]: ./packaging.md

0 commit comments

Comments
 (0)