forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Blob test new migration (Azure#8215)
* Test framework improvement * Test update * Rercordings * CI configuration * Missing pytest.ini
- Loading branch information
Showing
1,294 changed files
with
267,820 additions
and
818,536 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pytest] | ||
usefixtures = storage_account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
# coding: utf-8 | ||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# -------------------------------------------------------------------------- | ||
import asyncio | ||
import functools | ||
from testcase import StorageTestCase | ||
|
||
LOGGING_FORMAT = '%(asctime)s %(name)-20s %(levelname)-5s %(message)s' | ||
|
||
class AsyncBlobTestCase(StorageTestCase): | ||
@staticmethod | ||
def await_prepared_test(test_fn): | ||
"""Synchronous wrapper for async test methods. Used to avoid making changes | ||
upstream to AbstractPreparer (which doesn't await the functions it wraps) | ||
""" | ||
|
||
@functools.wraps(test_fn) | ||
def run(test_class_instance, *args, **kwargs): | ||
loop = asyncio.get_event_loop() | ||
return loop.run_until_complete(test_fn(test_class_instance, **kwargs)) | ||
|
||
return run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# -------------------------------------------------------------------------- | ||
# | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# | ||
# The MIT License (MIT) | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the ""Software""), to | ||
# deal in the Software without restriction, including without limitation the | ||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
# sell copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
# IN THE SOFTWARE. | ||
# | ||
# -------------------------------------------------------------------------- | ||
from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer, AzureMgmtTestCase | ||
from azure_devtools.scenario_tests import create_random_name | ||
from testcase import StorageTestCase | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def storage_account(): | ||
test_case = AzureMgmtTestCase("__init__") | ||
rg_preparer = ResourceGroupPreparer() | ||
storage_preparer = StorageAccountPreparer(name_prefix='pyacrstorage') | ||
|
||
# Set what the decorator is supposed to set for us | ||
for prep in [rg_preparer, storage_preparer]: | ||
prep.live_test = False | ||
prep.test_class_instance = test_case | ||
|
||
# Create | ||
rg_name = create_random_name("pystorage", 24) | ||
storage_name = create_random_name("pyacrstorage", 24) | ||
try: | ||
rg = rg_preparer.create_resource(rg_name) | ||
StorageTestCase._RESOURCE_GROUP = rg['resource_group'] | ||
try: | ||
storage_dict = storage_preparer.create_resource( | ||
storage_name, | ||
resource_group=rg['resource_group'] | ||
) | ||
# Now the magic begins | ||
StorageTestCase._STORAGE_ACCOUNT = storage_dict['storage_account'] | ||
StorageTestCase._STORAGE_KEY = storage_dict['storage_account_key'] | ||
yield | ||
finally: | ||
storage_preparer.remove_resource( | ||
storage_name, | ||
resource_group=rg['resource_group'] | ||
) | ||
StorageTestCase._STORAGE_ACCOUNT = None | ||
StorageTestCase._STORAGE_KEY = None | ||
finally: | ||
rg_preparer.remove_resource(rg_name) | ||
StorageTestCase._RESOURCE_GROUP = None |
974 changes: 974 additions & 0 deletions
974
...ings/test_append_blob.test_app_blob_from_stream_nonseekable_chnked_upload_known_size.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
974 changes: 974 additions & 0 deletions
974
...rdings/test_append_blob.test_app_blob_from_stream_nonseekable_chnked_upload_unk_size.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.