diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index 650889b7089a..45146a1b2b55 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -117,6 +117,7 @@ jobs: PythonVersion: $(PythonVersion) BuildTargetingString: ${{ parameters.BuildTargetingString }} ToxTestEnv: 'whl,sdist' + ToxEnvParallel: '--tenvparallel' BeforeTestSteps: - task: DownloadPipelineArtifact@0 inputs: diff --git a/eng/pipelines/templates/steps/build-test.yml b/eng/pipelines/templates/steps/build-test.yml index 9ccfb7ad47da..2f281524cda8 100644 --- a/eng/pipelines/templates/steps/build-test.yml +++ b/eng/pipelines/templates/steps/build-test.yml @@ -10,6 +10,7 @@ parameters: BuildTargetingString: 'azure-*' ToxTestEnv: "" RunCoverage: ne(variables['CoverageArg'], '--disablecov') + ToxEnvParallel: '' steps: - pwsh: | @@ -41,6 +42,7 @@ steps: --mark_arg="${{ parameters.TestMarkArgument }}" --service="${{ parameters.ServiceDirectory }}" --toxenv="${{ parameters.ToxTestEnv }}" + ${{ parameters.ToxEnvParallel }} env: ${{ parameters.EnvVars }} - task: PublishTestResults@2 diff --git a/eng/tox/tox.ini b/eng/tox/tox.ini index 899a45d39845..42bbdff3d264 100644 --- a/eng/tox/tox.ini +++ b/eng/tox/tox.ini @@ -2,6 +2,7 @@ # note that this envlist is the default set of environments that will run if a target environment is not selected. envlist = whl,sdist + [tools] deps = -r ../../../eng/test_tools.txt @@ -21,6 +22,7 @@ deps = [testenv] default_pytest_params = --junitxml={toxinidir}/test-junit-{envname}.xml --verbose --durations=10 --ignore=azure +parallel_show_output =True pre-deps = wheel skip_install = true @@ -35,10 +37,11 @@ setenv = deps = {[base]deps} changedir = {toxinidir} commands = - {envbindir}/python {toxinidir}/../../../eng/tox/create_wheel_and_install.py -d {distdir} -p {toxinidir} + {envbindir}/python {toxinidir}/../../../eng/tox/create_wheel_and_install.py -d {envtmpdir} -p {toxinidir} pip freeze pytest \ {[testenv]default_pytest_params} \ + --ignore=.tox \ {posargs} \ {toxinidir} @@ -79,6 +82,8 @@ commands = pip freeze pytest \ {posargs} \ + --no-cov \ + --ignore=.tox \ {toxinidir} @@ -92,8 +97,10 @@ deps = commands = pytest \ {posargs} \ + --ignore=.tox \ {toxinidir} + [testenv:sphinx] skipsdist = false skip_install = false @@ -127,7 +134,7 @@ changedir = {toxinidir} deps = {[tools]deps} commands = - {envbindir}/python {toxinidir}/../../../eng/tox/create_wheel_and_install.py -d {distdir} -p {toxinidir} + {envbindir}/python {toxinidir}/../../../eng/tox/create_wheel_and_install.py -d {envtmpdir} -p {toxinidir} {envbindir}/python {toxinidir}/../../../eng/tox/import_all.py -t {toxinidir} @@ -137,8 +144,8 @@ skip_install = true changedir = {toxinidir} deps = commands = - {envbindir}/python {toxinidir}/../../../eng/tox/create_wheel_and_install.py -d {distdir} -p {toxinidir} --skip-install True - {envbindir}/python {toxinidir}/../../../eng/tox/verify_whl.py -d {distdir} -t {toxinidir} + {envbindir}/python {toxinidir}/../../../eng/tox/create_wheel_and_install.py -d {envtmpdir} -p {toxinidir} --skip-install True + {envbindir}/python {toxinidir}/../../../eng/tox/verify_whl.py -d {envtmpdir} -t {toxinidir} [testenv:verifysdist] @@ -147,8 +154,8 @@ skip_install = true changedir = {toxinidir} deps = commands = - {envbindir}/python {toxinidir}/setup.py --q sdist --format zip -d {distdir} - {envbindir}/python {toxinidir}/../../../eng/tox/verify_sdist.py -d {distdir} -t {toxinidir} + {envbindir}/python {toxinidir}/setup.py --q sdist --format zip -d {envtmpdir} + {envbindir}/python {toxinidir}/../../../eng/tox/verify_sdist.py -d {envtmpdir} -t {toxinidir} [testenv:devtest] @@ -157,9 +164,10 @@ pre-deps = deps = {[base]deps} changedir = {toxinidir} commands = - {envbindir}/python {toxinidir}/../../../eng/tox/create_wheel_and_install.py -d {distdir} -p {toxinidir} + {envbindir}/python {toxinidir}/../../../eng/tox/create_wheel_and_install.py -d {envtmpdir} -p {toxinidir} {envbindir}/python {toxinidir}/../../../eng/tox/install_dev_build_dependency.py -t {toxinidir} pytest \ {[testenv]default_pytest_params} \ + --ignore=.tox \ {posargs} \ {toxinidir} \ No newline at end of file diff --git a/scripts/devops_tasks/common_tasks.py b/scripts/devops_tasks/common_tasks.py index fe97d41bf559..48ea1b35f83d 100644 --- a/scripts/devops_tasks/common_tasks.py +++ b/scripts/devops_tasks/common_tasks.py @@ -40,7 +40,8 @@ "mgmt", "azure-cognitiveservices", "azure-servicefabric", - "nspkg" + "nspkg", + "azure-keyvault" ] NON_MANAGEMENT_CODE_5_ALLOWED = [ "azure-keyvault" diff --git a/scripts/devops_tasks/setup_execute_tests.py b/scripts/devops_tasks/setup_execute_tests.py index c02119f71f7d..2529a61246ab 100644 --- a/scripts/devops_tasks/setup_execute_tests.py +++ b/scripts/devops_tasks/setup_execute_tests.py @@ -226,6 +226,13 @@ def execute_global_install_and_test( action="store_true", ) + parser.add_argument( + "--tenvparallel", + default=False, + help=("Run individual tox env for each package in parallel."), + action="store_true", + ) + parser.add_argument( "--service", help=( diff --git a/scripts/devops_tasks/tox_harness.py b/scripts/devops_tasks/tox_harness.py index 34a66a90d009..b1e728a3b58d 100644 --- a/scripts/devops_tasks/tox_harness.py +++ b/scripts/devops_tasks/tox_harness.py @@ -199,6 +199,26 @@ def execute_tox_parallel(tox_command_tuples): exit(1) +def replace_dev_reqs(file): + adjusted_req_lines = [] + + with open(file, "r") as f: + for line in f: + args = [ + part.strip() + for part in line.split() + if part and not part.strip() == "-e" + ] + amended_line = " ".join(args) + adjusted_req_lines.append(amended_line) + + with open(file, "w") as f: + # note that we directly use '\n' here instead of os.linesep due to how f.write() actually handles this stuff internally + # If a file is opened in text mode (the default), during write python will accidentally double replace due to "\r" being + # replaced with "\r\n" on Windows. Result: "\r\n\n". Extra line breaks! + f.write("\n".join(adjusted_req_lines)) + + def execute_tox_serial(tox_command_tuples): for index, cmd_tuple in enumerate(tox_command_tuples): tox_dir = os.path.join(cmd_tuple[1], "./.tox/") @@ -260,9 +280,15 @@ def prep_and_run_tox(targeted_packages, parsed_args, options_array=[]): with open(destination_dev_req, "w+") as file: file.write("\n") + if in_ci(): + replace_dev_reqs(destination_dev_req) + if parsed_args.tox_env: tox_execution_array.extend(["-e", parsed_args.tox_env]) + if parsed_args.tenvparallel: + tox_execution_array.extend(["-p", "all"]) + if local_options_array: tox_execution_array.extend(["--"] + local_options_array) diff --git a/sdk/core/azure-core/dev_requirements.txt b/sdk/core/azure-core/dev_requirements.txt index 6ee135e73056..8b52ac11404e 100644 --- a/sdk/core/azure-core/dev_requirements.txt +++ b/sdk/core/azure-core/dev_requirements.txt @@ -7,4 +7,3 @@ opencensus>=0.6.0 opencensus-ext-azure>=0.3.1 opencensus-ext-threading mock - diff --git a/sdk/keyvault/azure-keyvault/dev_requirements.txt b/sdk/keyvault/azure-keyvault/dev_requirements.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sdk/storage/azure-storage-blob/tests/test_append_blob.py b/sdk/storage/azure-storage-blob/tests/test_append_blob.py index ed33d956b57f..317dd1b7e415 100644 --- a/sdk/storage/azure-storage-blob/tests/test_append_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_append_blob.py @@ -12,6 +12,7 @@ remove, ) import unittest +import uuid from datetime import datetime, timedelta from azure.core import MatchConditions @@ -926,7 +927,7 @@ def test_append_blob_from_path_chunked_upload(self, resource_group, location, st self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'from_path_chunked_upload.temp.dat' + FILE_PATH = 'from_path_chunked_upload.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -949,7 +950,7 @@ def test_append_blob_from_path_with_progress_chunked_upload(self, resource_group self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'progress_chunked_upload.temp.dat' + FILE_PATH = 'progress_chunked_upload.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -984,7 +985,7 @@ def test_append_blob_from_stream_chunked_upload(self, resource_group, location, self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'stream_chunked_upload.temp.dat' + FILE_PATH = 'stream_chunked_upload.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1006,7 +1007,7 @@ def test_app_blob_from_stream_nonseekable_chnked_upload_known_size(self, resourc self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'upload_known_size.temp.dat' + FILE_PATH = 'upload_known_size.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) blob_size = len(data) - 66 @@ -1027,7 +1028,7 @@ def test_app_blob_from_stream_nonseekable_chnked_upload_unk_size(self, resource_ self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'upload_unk_size.temp.dat' + FILE_PATH = 'upload_unk_size.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1047,7 +1048,7 @@ def test_append_blob_from_stream_with_multiple_appends(self, resource_group, loc self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'multiple_appends.temp.dat' + FILE_PATH = 'multiple_appends.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream1: stream1.write(data) with open(FILE_PATH, 'wb') as stream2: @@ -1071,7 +1072,7 @@ def test_append_blob_from_stream_chunked_upload_with_count(self, resource_group, self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'upload_with_count.temp.dat' + FILE_PATH = 'upload_with_count.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1093,7 +1094,7 @@ def test_append_blob_from_stream_chunked_upload_with_count_parallel(self, resour self._setup(bsc) blob = self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'upload_with_count_parallel.temp.dat' + FILE_PATH = 'upload_with_count_parallel.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) diff --git a/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py index 6c62ea4e84e5..46b0b7a5d717 100644 --- a/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py @@ -15,6 +15,7 @@ remove, ) import unittest +import uuid from azure.core import MatchConditions from azure.core.exceptions import HttpResponseError, ResourceNotFoundError, ResourceModifiedError @@ -34,7 +35,7 @@ # ------------------------------------------------------------------------------ TEST_BLOB_PREFIX = 'blob' -FILE_PATH = 'blob_input.temp.dat' +FILE_PATH = 'blob_input.temp.{}.dat'.format(str(uuid.uuid4())) LARGE_BLOB_SIZE = 64 * 1024 @@ -1020,7 +1021,7 @@ async def test_append_blob_from_path_chunked_upload_async(self, resource_group, await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'path_chunked_upload_async.temp.dat' + FILE_PATH = 'path_chunked_upload_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1045,7 +1046,7 @@ async def test_append_blob_from_path_with_progress_chunked_upload_async(self, re await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'progress_chnked_upload_async.temp.dat' + FILE_PATH = 'progress_chnked_upload_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1082,7 +1083,7 @@ async def test_append_blob_from_stream_chunked_upload_async(self, resource_group await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'stream_chunked_upload_async.temp.dat' + FILE_PATH = 'stream_chunked_upload_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1107,7 +1108,7 @@ async def test_append_blob_from_stream_non_seekable_chunked_upload_known_size_as await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'chnkd_upld_knwn_size_async.temp.dat' + FILE_PATH = 'chnkd_upld_knwn_size_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) blob_size = len(data) - 66 @@ -1131,7 +1132,7 @@ async def test_append_blob_from_stream_non_seekable_chunked_upload_unknown_size_ await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'nonseek_chnked_upld_unk_size_async.temp.dat' + FILE_PATH = 'nonseek_chnked_upld_unk_size_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1153,7 +1154,7 @@ async def test_append_blob_from_stream_with_multiple_appends_async(self, resourc await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'stream_with_multiple_appends_async.temp.dat' + FILE_PATH = 'stream_with_multiple_appends_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream1: stream1.write(data) with open(FILE_PATH, 'wb') as stream2: @@ -1179,7 +1180,7 @@ async def test_append_blob_from_stream_chunked_upload_with_count_async(self, res await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'hnked_upload_w_count_async.temp.dat' + FILE_PATH = 'hnked_upload_w_count_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1204,7 +1205,7 @@ async def test_append_blob_from_stream_chunked_upload_with_count_parallel_async( await self._setup(bsc) blob = await self._create_blob(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'upload_w_count_parallel_async.temp.dat' + FILE_PATH = 'upload_w_count_parallel_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) diff --git a/sdk/storage/azure-storage-blob/tests/test_block_blob.py b/sdk/storage/azure-storage-blob/tests/test_block_blob.py index 4605298439ed..903ac11afe3f 100644 --- a/sdk/storage/azure-storage-blob/tests/test_block_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_block_blob.py @@ -8,6 +8,7 @@ import os import unittest import pytest +import uuid from azure.core.exceptions import HttpResponseError, ResourceExistsError from azure.storage.blob import ( @@ -574,7 +575,7 @@ def test_create_blob_from_path(self, resource_group, location, storage_account, blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'create_blob_from_input.temp.dat' + FILE_PATH = 'create_blob_from_input.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -595,7 +596,7 @@ def test_create_blob_from_path_non_parallel(self, resource_group, location, stor blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(100) - FILE_PATH = 'create_blob_from_path_non_par.temp.dat' + FILE_PATH = 'create_blob_from_path_non_par.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -617,7 +618,7 @@ def test_upload_blob_from_path_non_parallel_with_standard_blob_tier(self, resour blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(100) - FILE_PATH = '_path_non_parallel_with_standard_blob.temp.dat' + FILE_PATH = '_path_non_parallel_with_standard_blob.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) blob_tier = StandardBlobTier.Cool @@ -639,7 +640,7 @@ def test_create_blob_from_path_with_progress(self, resource_group, location, sto blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'create_blob_from_path_with_progr.temp.dat' + FILE_PATH = 'create_blob_from_path_with_progr.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -668,7 +669,7 @@ def test_create_blob_from_path_with_properties(self, resource_group, location, s blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'blob_from_path_with_properties.temp.dat' + FILE_PATH = 'blob_from_path_with_properties.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -695,7 +696,7 @@ def test_create_blob_from_stream_chunked_upload(self, resource_group, location, blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'blob_from_stream_chunked_up.temp.dat' + FILE_PATH = 'blob_from_stream_chunked_up.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -720,7 +721,7 @@ def test_create_frm_stream_nonseek_chunk_upld_knwn_size(self, resource_group, lo blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) blob_size = len(data) - 66 - FILE_PATH = 'stream_nonseek_chunk_upld_knwn_size.temp.dat' + FILE_PATH = 'stream_nonseek_chunk_upld_knwn_size.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -742,7 +743,7 @@ def test_create_from_stream_nonseek_chunk_upld_unkwn_size(self, resource_group, blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'stream_nonseek_chunk_upld.temp.dat' + FILE_PATH = 'stream_nonseek_chunk_upld.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -764,7 +765,7 @@ def test_create_blob_from_stream_with_progress_chunked_upload(self, resource_gro blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'stream_with_progress_chunked.temp.dat' + FILE_PATH = 'stream_with_progress_chunked.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -793,7 +794,7 @@ def test_create_blob_from_stream_chunked_upload_with_count(self, resource_group, blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'chunked_upload_with_count.temp.dat' + FILE_PATH = 'chunked_upload_with_count.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -815,7 +816,7 @@ def test_create_from_stream_chunk_upload_with_cntandrops(self, resource_group, l blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'from_stream_chunk_upload_with_cntandrops.temp.dat' + FILE_PATH = 'from_stream_chunk_upload_with_cntandrops.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -843,7 +844,7 @@ def test_create_blob_from_stream_chnked_upload_with_properties(self, resource_gr blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'chnked_upload_with_properti.temp.dat' + FILE_PATH = 'chnked_upload_with_properti.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -871,7 +872,7 @@ def test_create_blob_from_stream_chunked_upload_with_properties(self, resource_g blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'blob_from_stream_chunked_upload.temp.dat' + FILE_PATH = 'blob_from_stream_chunked_upload.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) blob_tier = StandardBlobTier.Cool diff --git a/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py index 9f65ba89b5dc..a0b16c0cfe84 100644 --- a/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py @@ -9,6 +9,7 @@ import unittest import pytest import asyncio +import uuid from azure.core.exceptions import HttpResponseError, ResourceExistsError from azure.core.pipeline.transport import AioHttpTransport @@ -642,7 +643,7 @@ async def test_create_blob_from_path(self, resource_group, location, storage_acc blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'create_blob_from_path.temp.dat' + FILE_PATH = 'create_blob_from_path.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -665,7 +666,7 @@ async def test_create_blob_from_path_non_parallel(self, resource_group, location blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(100) - FILE_PATH = 'from_path_non_parallel.temp.dat' + FILE_PATH = 'from_path_non_parallel.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -687,7 +688,7 @@ async def _test_upload_blob_from_path_non_parallel_with_standard_blob_tier(self, await self._setup(storage_account.name, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) - FILE_PATH = 'non_parallel_with_standard_blob_tier.temp.dat' + FILE_PATH = 'non_parallel_with_standard_blob_tier.temp.{}.dat'.format(str(uuid.uuid4())) data = self.get_random_bytes(100) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -712,7 +713,7 @@ async def test_create_blob_from_path_with_progress(self, resource_group, locatio blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'blob_from_path_with_progressasync.temp.dat' + FILE_PATH = 'blob_from_path_with_progressasync.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -743,7 +744,7 @@ async def test_create_blob_from_path_with_properties(self, resource_group, locat blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'create_blob_from_path_with_propertiesasync.temp.dat' + FILE_PATH = 'create_blob_from_path_with_propertiesasync.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -772,7 +773,7 @@ async def test_create_blob_from_stream_chunked_upload(self, resource_group, loca blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'create_blob_from_stream_chunked_uploadasync.temp.dat' + FILE_PATH = 'create_blob_from_stream_chunked_uploadasync.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -799,7 +800,7 @@ async def test_create_frm_stream_nonseek_chunk_upload_knwn_size(self, resource_g blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) blob_size = len(data) - 66 - FILE_PATH = 'create_frm_stream_nonseek_chunk_upload_knwn_sizeasync.temp.dat' + FILE_PATH = 'create_frm_stream_nonseek_chunk_upload_knwn_sizeasync.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -823,7 +824,7 @@ async def test_blob_frm_strm_nonseek_chunk_upld_unkwn_size(self, resource_group, blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'strm_nonseek_chunk_upld_unkwn_size_async.temp.dat' + FILE_PATH = 'strm_nonseek_chunk_upld_unkwn_size_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -847,7 +848,7 @@ async def test_create_blob_from_stream_with_progress_chunked_upload(self, resour blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'from_stream_with_progress_chunked_upload.temp.dat' + FILE_PATH = 'from_stream_with_progress_chunked_upload.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -878,7 +879,7 @@ async def test_create_blob_from_stream_chunked_upload_with_count(self, resource_ blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'blob_from_stream_chunked_upload_with.temp.dat' + FILE_PATH = 'blob_from_stream_chunked_upload_with.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -902,7 +903,7 @@ async def test_create_frm_stream_chu_upld_with_countandprops(self, resource_grou blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = '_frm_stream_chu_upld_with_count.temp.dat' + FILE_PATH = '_frm_stream_chu_upld_with_count.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -932,7 +933,7 @@ async def test_create_blob_from_stream_chunked_upload_with_properties(self, reso blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = '_from_stream_chunked_upload_with_propert.temp.dat' + FILE_PATH = '_from_stream_chunked_upload_with_propert.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -961,7 +962,7 @@ async def _test_create_blob_from_stream_chunked_upload_with_properties(self, res blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'tream_chunked_upload_with_properti.temp.dat' + FILE_PATH = 'tream_chunked_upload_with_properti.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) blob_tier = StandardBlobTier.Cool diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob.py b/sdk/storage/azure-storage-blob/tests/test_common_blob.py index 8f342fe7db39..e99be1d94238 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob.py @@ -10,6 +10,7 @@ import requests import time import unittest +import uuid import os from datetime import datetime, timedelta @@ -1721,7 +1722,7 @@ def test_download_to_file_with_sas(self, resource_group, location, storage_accou expiry=datetime.utcnow() + timedelta(hours=1), ) blob = BlobClient.from_blob_url(source_blob.url, credential=sas_token) - FILE_PATH = 'download_to_file_with_sas.temp.dat' + FILE_PATH = 'download_to_file_with_sas.temp.{}.dat'.format(str(uuid.uuid4())) # Act download_blob_from_url(blob.url, FILE_PATH) @@ -1741,7 +1742,7 @@ def test_download_to_file_with_credential(self, resource_group, location, storag self._setup_remote(rmt.name, rmt_key) self._create_remote_container() source_blob = self._create_remote_block_blob(blob_data=data) - FILE_PATH = 'to_file_with_credential.temp.dat' + FILE_PATH = 'to_file_with_credential.temp.{}.dat'.format(str(uuid.uuid4())) # Act download_blob_from_url( source_blob.url, FILE_PATH, @@ -1762,7 +1763,7 @@ def test_download_to_stream_with_credential(self, resource_group, location, stor self._setup_remote(rmt.name, rmt_key) self._create_remote_container() source_blob = self._create_remote_block_blob(blob_data=data) - FILE_PATH = 'download_to_stream_with_credential.temp.dat' + FILE_PATH = 'download_to_stream_with_credential.temp.{}.dat'.format(str(uuid.uuid4())) # Act with open(FILE_PATH, 'wb') as stream: download_blob_from_url( @@ -1785,7 +1786,7 @@ def test_download_to_file_with_existing_file(self, resource_group, location, sto self._setup_remote(rmt.name, rmt_key) self._create_remote_container() source_blob = self._create_remote_block_blob(blob_data=data) - FILE_PATH = 'file_with_existing_file.temp.dat' + FILE_PATH = 'file_with_existing_file.temp.{}.dat'.format(str(uuid.uuid4())) # Act download_blob_from_url( source_blob.url, FILE_PATH, @@ -1809,7 +1810,7 @@ def test_download_to_file_with_existing_file_overwrite(self, resource_group, loc self._setup_remote(rmt.name, rmt_key) self._create_remote_container() source_blob = self._create_remote_block_blob(blob_data=data) - FILE_PATH = 'file_with_existing_file_overwrite.temp.dat' + FILE_PATH = 'file_with_existing_file_overwrite.temp.{}.dat'.format(str(uuid.uuid4())) # Act download_blob_from_url( source_blob.url, FILE_PATH, @@ -1942,7 +1943,7 @@ def test_upload_to_url_text_with_credential(self, resource_group, location, stor @GlobalStorageAccountPreparer() def test_upload_to_url_file_with_credential(self, resource_group, location, storage_account, storage_account_key): # SAS URL is calculated from storage key, so this test runs live only - FILE_PATH = 'upload_to_url_file_with_credential.temp.dat' + FILE_PATH = 'upload_to_url_file_with_credential.temp.{}.dat'.format(str(uuid.uuid4())) self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 with open(FILE_PATH, 'wb') as stream: diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py index e8d23cd41ebc..b67130eb31fd 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py @@ -13,6 +13,7 @@ import time import unittest import os +import uuid from datetime import datetime, timedelta from azure.core.exceptions import ( @@ -1803,7 +1804,7 @@ async def test_download_to_file_with_sas(self, resource_group, location, storage permission=BlobSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) - FILE_PATH = '_to_file_with_sas.async.dat' + FILE_PATH = '_to_file_with_sas.async.{}.dat'.format(str(uuid.uuid4())) blob = BlobClient.from_blob_url(source_blob.url, credential=sas_token) # Act @@ -1826,7 +1827,7 @@ async def test_download_to_file_with_credential(self, resource_group, location, await self._setup_remote(rmt.name, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) - FILE_PATH = 'to_file_with_credential.async.dat' + FILE_PATH = 'to_file_with_credential.async.{}.dat'.format(str(uuid.uuid4())) # Act await download_blob_from_url( source_blob.url, FILE_PATH, @@ -1850,7 +1851,7 @@ async def test_download_to_stream_with_credential(self, resource_group, location await self._setup_remote(rmt.name, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) - FILE_PATH = 'to_stream_with_credential.async.dat' + FILE_PATH = 'to_stream_with_credential.async.{}.dat'.format(str(uuid.uuid4())) # Act with open(FILE_PATH, 'wb') as stream: await download_blob_from_url( @@ -1875,7 +1876,7 @@ async def test_download_to_file_with_existing_file(self, resource_group, locatio await self._setup_remote(rmt.name, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) - FILE_PATH = 'with_existing_file.async.dat' + FILE_PATH = 'with_existing_file.async.{}.dat'.format(str(uuid.uuid4())) # Act await download_blob_from_url( source_blob.url, FILE_PATH, @@ -1901,7 +1902,7 @@ async def test_download_to_file_with_existing_file_overwrite(self, resource_grou await self._setup_remote(rmt.name, rmt_key) await self._create_remote_container() source_blob = await self._create_remote_block_blob(blob_data=data) - FILE_PATH = 'existing_file_overwrite.async.dat' + FILE_PATH = 'existing_file_overwrite.async.{}.dat'.format(str(uuid.uuid4())) # Act await download_blob_from_url( source_blob.url, FILE_PATH, @@ -2048,7 +2049,7 @@ async def test_upload_to_url_file_with_credential(self, resource_group, location # Arrange await self._setup(storage_account.name, storage_account_key) data = b'12345678' * 1024 * 1024 - FILE_PATH = 'url_file_with_credential.async.dat' + FILE_PATH = 'url_file_with_credential.async.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) blob_name = self._get_blob_reference() diff --git a/sdk/storage/azure-storage-blob/tests/test_get_blob.py b/sdk/storage/azure-storage-blob/tests/test_get_blob.py index f0b37ef68da2..35c97a411368 100644 --- a/sdk/storage/azure-storage-blob/tests/test_get_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_get_blob.py @@ -8,6 +8,7 @@ import pytest import base64 import unittest +import uuid from os import path, remove, sys, urandom from azure.core.exceptions import HttpResponseError from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer @@ -296,7 +297,7 @@ def test_get_blob_to_stream(self, resource_group, location, storage_account, sto blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'get_blob_to_streamm.temp.dat' + FILE_PATH = 'get_blob_to_streamm.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob(max_concurrency=2) read_bytes = downloader.readinto(stream) @@ -323,7 +324,7 @@ def callback(response): progress.append((current, total)) # Act - FILE_PATH = 'blob_to_stream_with_progress.temp.dat' + FILE_PATH = 'blob_to_stream_with_progress.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob(raw_response_hook=callback, max_concurrency=2) read_bytes = downloader.readinto(stream) @@ -351,7 +352,7 @@ def callback(response): progress.append((current, total)) # Act - FILE_PATH = 'stream_non_parallel.temp.dat' + FILE_PATH = 'stream_non_parallel.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob(raw_response_hook=callback, max_concurrency=1) read_bytes = downloader.readinto(stream) @@ -385,7 +386,7 @@ def callback(response): # Act - FILE_PATH = 'blob_to_stream_small.temp.dat' + FILE_PATH = 'blob_to_stream_small.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob(raw_response_hook=callback, max_concurrency=2) read_bytes = downloader.readinto(stream) @@ -411,7 +412,7 @@ def test_ranged_get_blob_to_path(self, resource_group, location, storage_account blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'get_blob_to_path.temp.dat' + FILE_PATH = 'get_blob_to_path.temp.{}.dat'.format(str(uuid.uuid4())) end_range = self.config.max_single_get_size with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob(offset=1, length=end_range - 1, max_concurrency=2) @@ -441,7 +442,7 @@ def callback(response): # Act start_range = 3 end_range = self.config.max_single_get_size + 1024 - FILE_PATH = 'blob_to_path_with_progress.temp.dat' + FILE_PATH = 'blob_to_path_with_progress.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob( offset=start_range, @@ -468,7 +469,7 @@ def test_ranged_get_blob_to_path_small(self, resource_group, location, storage_a blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'blob_to_path_small.temp.dat' + FILE_PATH = 'blob_to_path_small.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob(offset=1, length=4, max_concurrency=2) read_bytes = downloader.readinto(stream) @@ -486,7 +487,7 @@ def test_ranged_get_blob_to_path_non_parallel(self, resource_group, location, st blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'blob_to_path_non_parallel.temp.dat' + FILE_PATH = 'blob_to_path_non_parallel.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob(offset=1, length=3, max_concurrency=1) read_bytes = downloader.readinto(stream) @@ -512,7 +513,7 @@ def test_ranged_get_blob_to_path_invalid_range_parallel(self, resource_group, lo # Act end_range = 2 * self.config.max_single_get_size - FILE_PATH = 'path_invalid_range_parallel.temp.dat' + FILE_PATH = 'path_invalid_range_parallel.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob(offset=1, length=end_range, max_concurrency=2) read_bytes = downloader.readinto(stream) @@ -538,7 +539,7 @@ def test_ranged_get_blob_to_path_invalid_range_non_parallel(self, resource_group # Act end_range = 2 * self.config.max_single_get_size - FILE_PATH = 'invalid_range_non_parallel.temp.dat' + FILE_PATH = 'invalid_range_non_parallel.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob(offset=1, length=end_range, max_concurrency=2) read_bytes = downloader.readinto(stream) @@ -708,7 +709,7 @@ def test_get_blob_non_seekable(self, resource_group, location, storage_account, blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'get_blob_non_seekable.temp.dat' + FILE_PATH = 'get_blob_non_seekable.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: non_seekable_stream = StorageGetBlobTest.NonSeekableFile(stream) downloader = blob.download_blob(max_concurrency=1) @@ -730,7 +731,7 @@ def test_get_blob_non_seekable_parallel(self, resource_group, location, storage_ blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'get_blob_non_seekable.temp.dat' + FILE_PATH = 'get_blob_non_seekable.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: non_seekable_stream = StorageGetBlobTest.NonSeekableFile(stream) @@ -755,7 +756,7 @@ def callback(response): progress.append((current, total)) # Act - FILE_PATH = 'blob_to_stream_exact_get_size.temp.dat' + FILE_PATH = 'blob_to_stream_exact_get_size.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob(raw_response_hook=callback, max_concurrency=2) properties = downloader.readinto(stream) @@ -837,7 +838,7 @@ def test_get_blob_to_stream_with_md5(self, resource_group, location, storage_acc blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'stream_with_md5.temp.dat' + FILE_PATH = 'stream_with_md5.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob(validate_content=True, max_concurrency=2) read_bytes = downloader.readinto(stream) @@ -875,7 +876,7 @@ def test_get_blob_range_to_stream_with_overall_md5(self, resource_group, locatio blob.set_http_headers(props.content_settings) # Act - FILE_PATH = 'blob_range_to_stream_with_overall_md5.temp.dat' + FILE_PATH = 'blob_range_to_stream_with_overall_md5.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = blob.download_blob(offset=0, length=1024, validate_content=True, max_concurrency=2) read_bytes = downloader.readinto(stream) diff --git a/sdk/storage/azure-storage-blob/tests/test_get_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_get_blob_async.py index 1186e7aac001..a90d45a65028 100644 --- a/sdk/storage/azure-storage-blob/tests/test_get_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_get_blob_async.py @@ -10,6 +10,7 @@ from os import path, remove, sys, urandom import unittest import asyncio +import uuid from azure.core.exceptions import HttpResponseError from azure.core.pipeline.transport import AioHttpTransport @@ -333,7 +334,7 @@ async def test_get_blob_to_stream_async(self, resource_group, location, storage_ blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'get_blob_to_stream_async.temp.dat' + FILE_PATH = 'get_blob_to_stream_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob(max_concurrency=2) read_bytes = await downloader.readinto(stream) @@ -362,7 +363,7 @@ def callback(response): progress.append((current, total)) # Act - FILE_PATH = 'blob_to_stream_with_progress_async.temp.dat' + FILE_PATH = 'blob_to_stream_with_progress_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob(raw_response_hook=callback, max_concurrency=2) read_bytes = await downloader.readinto(stream) @@ -392,7 +393,7 @@ def callback(response): progress.append((current, total)) # Act - FILE_PATH = 'blob_to_stream_non_parallel_async.temp.dat' + FILE_PATH = 'blob_to_stream_non_parallel_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob(raw_response_hook=callback, max_concurrency=1) read_bytes = await downloader.readinto(stream) @@ -428,7 +429,7 @@ def callback(response): # Act - FILE_PATH = 'blob_to_stream_small_async.temp.dat' + FILE_PATH = 'blob_to_stream_small_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob(raw_response_hook=callback, max_concurrency=2) read_bytes = await downloader.readinto(stream) @@ -457,7 +458,7 @@ async def test_ranged_get_blob_to_path_async(self, resource_group, location, sto # Act end_range = self.config.max_single_get_size - FILE_PATH = 'ranged_get_blob_to_path_async.temp.dat' + FILE_PATH = 'ranged_get_blob_to_path_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob(offset=1, length=end_range-1, max_concurrency=2) read_bytes = await downloader.readinto(stream) @@ -488,7 +489,7 @@ def callback(response): # Act start_range = 3 end_range = self.config.max_single_get_size + 1024 - FILE_PATH = 'get_blob_to_path_with_progress_async.temp.dat' + FILE_PATH = 'get_blob_to_path_with_progress_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob( offset=start_range, @@ -517,7 +518,7 @@ async def test_ranged_get_blob_to_path_small_async(self, resource_group, locatio blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'get_blob_to_path_small_asyncc.temp.dat' + FILE_PATH = 'get_blob_to_path_small_asyncc.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob(offset=1, length=4, max_concurrency=2) read_bytes = await downloader.readinto(stream) @@ -537,7 +538,7 @@ async def test_ranged_get_blob_to_path_non_parallel_async(self, resource_group, blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'granged_get_blob_to_path_non_parallel_async.temp.dat' + FILE_PATH = 'granged_get_blob_to_path_non_parallel_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob(offset=1, length=3, max_concurrency=1) read_bytes = await downloader.readinto(stream) @@ -564,7 +565,7 @@ async def test_ranged_get_blob_to_path_invalid_range_parallel_async(self, resour await blob.upload_blob(blob_data) # Act - FILE_PATH = 'path_invalid_range_parallel_async.temp.dat' + FILE_PATH = 'path_invalid_range_parallel_async.temp.{}.dat'.format(str(uuid.uuid4())) end_range = 2 * self.config.max_single_get_size with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob(offset=1, length=end_range, max_concurrency=2) @@ -593,7 +594,7 @@ async def test_ranged_get_blob_to_path_invalid_range_non_parallel_async(self, re # Act end_range = 2 * self.config.max_single_get_size - FILE_PATH = 'path_invalid_range_non_parallel_asy.temp.dat' + FILE_PATH = 'path_invalid_range_non_parallel_asy.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob(offset=1, length=end_range, max_concurrency=2) read_bytes = await downloader.readinto(stream) @@ -776,7 +777,7 @@ async def test_get_blob_non_seekable_async(self, resource_group, location, stora blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'get_blob_non_seekable_async.temp.dat' + FILE_PATH = 'get_blob_non_seekable_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: non_seekable_stream = StorageGetBlobTestAsync.NonSeekableFile(stream) downloader = await blob.download_blob(max_concurrency=1) @@ -800,7 +801,7 @@ async def test_get_blob_non_seekable_parallel_async(self, resource_group, locati blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'et_blob_non_seekable_parallel_asyn.temp.dat' + FILE_PATH = 'et_blob_non_seekable_parallel_asyn.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: non_seekable_stream = StorageGetBlobTestAsync.NonSeekableFile(stream) @@ -827,7 +828,7 @@ def callback(response): progress.append((current, total)) # Act - FILE_PATH = 'stream_exact_get_size_async.temp.dat' + FILE_PATH = 'stream_exact_get_size_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob(raw_response_hook=callback, max_concurrency=2) properties = await downloader.readinto(stream) @@ -915,7 +916,7 @@ async def test_get_blob_to_stream_with_md5_async(self, resource_group, location, blob = self.bsc.get_blob_client(self.container_name, self.byte_blob) # Act - FILE_PATH = 'lob_to_stream_with_md5_asyncc.temp.dat' + FILE_PATH = 'lob_to_stream_with_md5_asyncc.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob(validate_content=True, max_concurrency=2) read_bytes = await downloader.readinto(stream) @@ -957,7 +958,7 @@ async def test_get_blob_range_to_stream_with_overall_md5_async(self, resource_gr await blob.set_http_headers(props.content_settings) # Act - FILE_PATH = 'range_to_stream_with_overall_md5_async.temp.dat' + FILE_PATH = 'range_to_stream_with_overall_md5_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: downloader = await blob.download_blob(offset=0, length=1024, validate_content=True, max_concurrency=2) read_bytes = await downloader.readinto(stream) diff --git a/sdk/storage/azure-storage-blob/tests/test_large_block_blob.py b/sdk/storage/azure-storage-blob/tests/test_large_block_blob.py index b18a4ff71551..a819ac2c124b 100644 --- a/sdk/storage/azure-storage-blob/tests/test_large_block_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_large_block_blob.py @@ -11,6 +11,7 @@ from os import path, remove, sys, urandom import platform import unittest +import uuid from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer from azure.storage.blob import ( BlobServiceClient, @@ -151,7 +152,7 @@ def test_create_large_blob_from_path(self, resource_group, location, storage_acc blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'large_blob_from_path.temp.dat' + FILE_PATH = 'large_blob_from_path.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -242,7 +243,7 @@ def test_create_large_blob_from_path_with_properties(self, resource_group, locat blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'blob_from_path_with_properties.temp.dat' + FILE_PATH = 'blob_from_path_with_properties.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -269,7 +270,7 @@ def test_create_large_blob_from_stream_chunked_upload(self, resource_group, loca blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'blob_from_stream_chunked_upload.temp.dat' + FILE_PATH = 'blob_from_stream_chunked_upload.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -290,7 +291,7 @@ def test_creat_lrgblob_frm_stream_w_progress_chnkd_upload(self, resource_group, blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'stream_w_progress_chnkd_upload.temp.dat' + FILE_PATH = 'stream_w_progress_chnkd_upload.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -318,7 +319,7 @@ def test_create_large_blob_from_stream_chunked_upload_with_count(self, resource_ blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'chunked_upload_with_count.temp.dat' + FILE_PATH = 'chunked_upload_with_count.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -340,7 +341,7 @@ def test_creat_lrgblob_frm_strm_chnkd_uplod_w_count_n_props(self, resource_group blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'plod_w_count_n_props.temp.dat' + FILE_PATH = 'plod_w_count_n_props.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -369,7 +370,7 @@ def test_creat_lrg_blob_frm_stream_chnked_upload_w_props(self, resource_group, l blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'creat_lrg_blob.temp.dat' + FILE_PATH = 'creat_lrg_blob.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) diff --git a/sdk/storage/azure-storage-blob/tests/test_large_block_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_large_block_blob_async.py index d26ce9483005..90ff42c1bee4 100644 --- a/sdk/storage/azure-storage-blob/tests/test_large_block_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_large_block_blob_async.py @@ -11,6 +11,7 @@ from os import path, remove, sys, urandom import unittest +import uuid from azure.core.pipeline.transport import AioHttpTransport from multidict import CIMultiDict, CIMultiDictProxy @@ -182,7 +183,7 @@ async def test_create_large_blob_from_path_async(self, resource_group, location, blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'create_large_blob_from_path_async.temp.dat' + FILE_PATH = 'create_large_blob_from_path_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -207,7 +208,7 @@ async def test_create_large_blob_from_path_with_md5_async(self, resource_group, blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'reate_large_blob_from_path_with_md5_async.temp.dat' + FILE_PATH = 'reate_large_blob_from_path_with_md5_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -231,7 +232,7 @@ async def test_create_large_blob_from_path_non_parallel_async(self, resource_gro blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(self.get_random_bytes(100)) - FILE_PATH = 'large_blob_from_path_non_parallel_async.temp.dat' + FILE_PATH = 'large_blob_from_path_non_parallel_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -255,7 +256,7 @@ async def test_create_large_blob_from_path_with_progress_async(self, resource_gr await self._setup(storage_account.name, storage_account_key) blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) - FILE_PATH = 'large_blob_from_path_with_progress_asyn.temp.dat' + FILE_PATH = 'large_blob_from_path_with_progress_asyn.temp.{}.dat'.format(str(uuid.uuid4())) data = bytearray(urandom(LARGE_BLOB_SIZE)) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -289,7 +290,7 @@ async def test_create_large_blob_from_path_with_properties_async(self, resource_ blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'large_blob_from_path_with_properties_asy.temp.dat' + FILE_PATH = 'large_blob_from_path_with_properties_asy.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -320,7 +321,7 @@ async def test_creat_lrg_blob_frm_stream_chnkd_upload_async(self, resource_group blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'frm_stream_chnkd_upload_async.temp.dat' + FILE_PATH = 'frm_stream_chnkd_upload_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -345,7 +346,7 @@ async def test_creat_lrgblob_frm_strm_w_prgrss_chnkduplod_async(self, resource_g blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'frm_strm_w_prgrss_chnkduplod_async.temp.dat' + FILE_PATH = 'frm_strm_w_prgrss_chnkduplod_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -378,7 +379,7 @@ async def test_creat_lrgblob_frm_strm_chnkd_uplod_w_cnt_async(self, resource_gro blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = '_lrgblob_frm_strm_chnkd_uplod_w_cnt_.temp.dat' + FILE_PATH = '_lrgblob_frm_strm_chnkd_uplod_w_cnt_.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -404,7 +405,7 @@ async def test_creat_lrg_frm_stream_chnk_upload_w_cntnprops(self, resource_group blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'frm_stream_chnk_upload_w_cntnprops_async.temp.dat' + FILE_PATH = 'frm_stream_chnk_upload_w_cntnprops_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -437,7 +438,7 @@ async def test_create_large_from_stream_chunk_upld_with_props(self, resource_gro blob_name = self._get_blob_reference() blob = self.bsc.get_blob_client(self.container_name, blob_name) data = bytearray(urandom(LARGE_BLOB_SIZE)) - FILE_PATH = 'from_stream_chunk_upld_with_props_async.temp.dat' + FILE_PATH = 'from_stream_chunk_upld_with_props_async.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) diff --git a/sdk/storage/azure-storage-blob/tests/test_page_blob.py b/sdk/storage/azure-storage-blob/tests/test_page_blob.py index 80c5505f69b3..dbf9573c034f 100644 --- a/sdk/storage/azure-storage-blob/tests/test_page_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_page_blob.py @@ -10,6 +10,7 @@ import pytest import os import unittest +import uuid from datetime import datetime, timedelta from azure.core import MatchConditions from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceModifiedError @@ -1210,7 +1211,7 @@ def test_create_blob_from_path(self, resource_group, location, storage_account, self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'create_blob_from_path.temp.dat' + FILE_PATH = 'create_blob_from_path.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1234,7 +1235,7 @@ def test_create_blob_from_path_with_progress(self, resource_group, location, sto self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'create_blob_from_path_with_progress.temp.dat' + FILE_PATH = 'create_blob_from_path_with_progress.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1263,7 +1264,7 @@ def test_create_blob_from_stream(self, resource_group, location, storage_account self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'st_create_blob_from_stream.temp.dat' + FILE_PATH = 'st_create_blob_from_stream.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1291,7 +1292,7 @@ def test_create_blob_from_stream_with_empty_pages(self, resource_group, location data = bytearray(LARGE_BLOB_SIZE) data[512: 1024] = self.get_random_bytes(512) data[8192: 8196] = self.get_random_bytes(4) - FILE_PATH = 'create_blob_from_stream_with_empty_pages.temp.dat' + FILE_PATH = 'create_blob_from_stream_with_empty_pages.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1323,7 +1324,7 @@ def test_create_blob_from_stream_non_seekable(self, resource_group, location, st self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'create_blob_from_stream_non_seekable.temp.dat' + FILE_PATH = 'create_blob_from_stream_non_seekable.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1350,7 +1351,7 @@ def test_create_blob_from_stream_with_progress(self, resource_group, location, s self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'create_blob_from_stream_with_proge.temp.dat' + FILE_PATH = 'create_blob_from_stream_with_proge.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1381,7 +1382,7 @@ def test_create_blob_from_stream_truncated(self, resource_group, location, stora self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'create_blob_from_stream_trun.temp.dat' + FILE_PATH = 'create_blob_from_stream_trun.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1403,7 +1404,7 @@ def test_create_blob_from_stream_with_progress_truncated(self, resource_group, l self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = '_blob_from_stream_with_progress_trunca.temp.dat' + FILE_PATH = '_blob_from_stream_with_progress_trunca.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1536,7 +1537,7 @@ def test_blob_tier_on_create(self, resource_group, location, storage_account, st # test create_blob_from_path API blob3 = self._get_blob_reference(bsc) pblob3 = pbs.get_blob_client(container_name, blob3.blob_name) - FILE_PATH = '_blob_tier_on_create.temp.dat' + FILE_PATH = '_blob_tier_on_create.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(byte_data) with open(FILE_PATH, 'rb') as stream: diff --git a/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py index 83ab9967848e..d25b8e5b4e8f 100644 --- a/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py @@ -10,6 +10,7 @@ import asyncio import os import unittest +import uuid from datetime import datetime, timedelta from azure.core import MatchConditions @@ -1256,7 +1257,7 @@ async def test_create_blob_from_path(self, resource_group, location, storage_acc await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'create_blob_from_p.temp.dat' + FILE_PATH = 'create_blob_from_p.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1281,7 +1282,7 @@ async def test_create_blob_from_path_with_progress(self, resource_group, locatio await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'create_blob_from_path_with_p.temp.dat' + FILE_PATH = 'create_blob_from_path_with_p.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1311,7 +1312,7 @@ async def test_create_blob_from_stream(self, resource_group, location, storage_a await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = '_create_blob_from_s.temp.dat' + FILE_PATH = '_create_blob_from_s.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1340,7 +1341,7 @@ async def test_create_blob_from_stream_with_empty_pages(self, resource_group, lo data = bytearray(LARGE_BLOB_SIZE) data[512: 1024] = self.get_random_bytes(512) data[8192: 8196] = self.get_random_bytes(4) - FILE_PATH = '_with_empty_pages.temp.dat' + FILE_PATH = '_with_empty_pages.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1374,7 +1375,7 @@ async def test_create_blob_from_stream_non_seekable(self, resource_group, locati await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'blob_from_stream_non_see.temp.dat' + FILE_PATH = 'blob_from_stream_non_see.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1402,7 +1403,7 @@ async def test_create_blob_from_stream_with_progress(self, resource_group, locat await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'rom_stream_with_progress.temp.dat' + FILE_PATH = 'rom_stream_with_progress.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1434,7 +1435,7 @@ async def test_create_blob_from_stream_truncated(self, resource_group, location, await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = '_create_blob_from_stream_trunc.temp.dat' + FILE_PATH = '_create_blob_from_stream_trunc.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1457,7 +1458,7 @@ async def test_create_blob_from_stream_with_progress_truncated(self, resource_gr await self._setup(bsc) blob = self._get_blob_reference(bsc) data = self.get_random_bytes(LARGE_BLOB_SIZE) - FILE_PATH = 'from_stream_with_progress_truncated.temp.dat' + FILE_PATH = 'from_stream_with_progress_truncated.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(data) @@ -1598,7 +1599,7 @@ async def test_blob_tier_on_create(self, resource_group, location, storage_accou # test create_blob_from_path API blob3 = self._get_blob_reference(bsc) pblob3 = pbs.get_blob_client(container_name, blob3.blob_name) - FILE_PATH = 'test_blob_tier_on_creat.temp.dat' + FILE_PATH = 'test_blob_tier_on_creat.temp.{}.dat'.format(str(uuid.uuid4())) with open(FILE_PATH, 'wb') as stream: stream.write(byte_data) with open(FILE_PATH, 'rb') as stream: diff --git a/sdk/storage/azure-storage-file-share/tests/test_file.py b/sdk/storage/azure-storage-file-share/tests/test_file.py index 71a62f6b3b8b..ca38bf8119a4 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file.py @@ -12,6 +12,7 @@ import requests import pytest +import uuid from azure.core import MatchConditions from azure.core.exceptions import HttpResponseError, ResourceNotFoundError, ResourceExistsError @@ -38,8 +39,8 @@ TEST_SHARE_PREFIX = 'share' TEST_DIRECTORY_PREFIX = 'dir' TEST_FILE_PREFIX = 'file' -INPUT_FILE_PATH = 'file_input.temp.dat' -OUTPUT_FILE_PATH = 'file_output.temp.dat' +INPUT_FILE_PATH = 'file_input.temp.{}.dat'.format(str(uuid.uuid4())) +OUTPUT_FILE_PATH = 'file_output.temp.{}.dat'.format(str(uuid.uuid4())) LARGE_FILE_SIZE = 64 * 1024 + 5 diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_async.py index f2a6f3ee43d8..a6415f3b7cb4 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_async.py @@ -14,6 +14,7 @@ from multidict import CIMultiDict, CIMultiDictProxy import requests import pytest +import uuid from azure.core.exceptions import HttpResponseError, ResourceNotFoundError, ResourceExistsError from azure.storage.fileshare import ( @@ -41,8 +42,8 @@ TEST_SHARE_PREFIX = 'share' TEST_DIRECTORY_PREFIX = 'dir' TEST_FILE_PREFIX = 'file' -INPUT_FILE_PATH = 'file_input.temp.dat' -OUTPUT_FILE_PATH = 'file_output.temp.dat' +INPUT_FILE_PATH = 'file_input.temp.{}.dat'.format(str(uuid.uuid4())) +OUTPUT_FILE_PATH = 'file_output.temp.{}.dat'.format(str(uuid.uuid4())) LARGE_FILE_SIZE = 64 * 1024 + 5 diff --git a/sdk/storage/azure-storage-file-share/tests/test_get_file.py b/sdk/storage/azure-storage-file-share/tests/test_get_file.py index 556e23baa75d..05ac1048bd85 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_get_file.py +++ b/sdk/storage/azure-storage-file-share/tests/test_get_file.py @@ -8,6 +8,7 @@ import base64 import os import unittest +import uuid import pytest from azure.core.exceptions import HttpResponseError @@ -25,8 +26,7 @@ # ------------------------------------------------------------------------------ TEST_FILE_PREFIX = 'file' -FILE_PATH = 'file_output.temp.dat' - +FILE_PATH = 'file_output.temp.{}.dat'.format(str(uuid.uuid4())) # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-file-share/tests/test_get_file_async.py b/sdk/storage/azure-storage-file-share/tests/test_get_file_async.py index 7be1bb3ba777..96b1a23f6c94 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_get_file_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_get_file_async.py @@ -9,6 +9,7 @@ import os import unittest import asyncio +import uuid import pytest from azure.core.pipeline.transport import AioHttpTransport @@ -27,7 +28,7 @@ # ------------------------------------------------------------------------------ TEST_FILE_PREFIX = 'file' -FILE_PATH = 'file_output.temp.dat' +FILE_PATH = 'file_output.temp.{}.dat'.format(str(uuid.uuid4())) # ------------------------------------------------------------------------------