Skip to content

Commit 6bc2485

Browse files
authored
Prevent DeprecationWarning in Identity tests (#19723)
1 parent e63c302 commit 6bc2485

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sdk/identity/azure-identity/tests/test_powershell_credential.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def fake_Popen(command, **_):
260260
assert command[-1].startswith("pwsh -NonInteractive -EncodedCommand ")
261261
encoded_script = command[-1].split()[-1]
262262
decoded_script = base64.b64decode(encoded_script).decode("utf-16-le")
263-
match = re.search("Get-AzAccessToken -ResourceUrl '(\S+)'(?: -TenantId (\S+))?", decoded_script)
263+
match = re.search(r"Get-AzAccessToken -ResourceUrl '(\S+)'(?: -TenantId (\S+))?", decoded_script)
264264
tenant = match.groups()[1]
265265

266266
assert tenant is None or tenant == second_tenant, 'unexpected tenant "{}"'.format(tenant)
@@ -292,7 +292,7 @@ def fake_Popen(command, **_):
292292
assert command[-1].startswith("pwsh -NonInteractive -EncodedCommand ")
293293
encoded_script = command[-1].split()[-1]
294294
decoded_script = base64.b64decode(encoded_script).decode("utf-16-le")
295-
match = re.search("Get-AzAccessToken -ResourceUrl '(\S+)'(?: -TenantId (\S+))?", decoded_script)
295+
match = re.search(r"Get-AzAccessToken -ResourceUrl '(\S+)'(?: -TenantId (\S+))?", decoded_script)
296296
tenant = match.groups()[1]
297297

298298
assert tenant is None, "credential shouldn't accept an explicit tenant ID"

sdk/identity/azure-identity/tests/test_powershell_credential_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ async def fake_exec(*args, **_):
263263
assert command.startswith("pwsh -NonInteractive -EncodedCommand ")
264264
encoded_script = command.split()[-1]
265265
decoded_script = base64.b64decode(encoded_script).decode("utf-16-le")
266-
match = re.search("Get-AzAccessToken -ResourceUrl '(\S+)'(?: -TenantId (\S+))?", decoded_script)
266+
match = re.search(r"Get-AzAccessToken -ResourceUrl '(\S+)'(?: -TenantId (\S+))?", decoded_script)
267267
tenant = match[2]
268268

269269
assert tenant is None or tenant == second_tenant, 'unexpected tenant "{}"'.format(tenant)
@@ -296,7 +296,7 @@ async def fake_exec(*args, **_):
296296
assert command.startswith("pwsh -NonInteractive -EncodedCommand ")
297297
encoded_script = command.split()[-1]
298298
decoded_script = base64.b64decode(encoded_script).decode("utf-16-le")
299-
match = re.search("Get-AzAccessToken -ResourceUrl '(\S+)'(?: -TenantId (\S+))?", decoded_script)
299+
match = re.search(r"Get-AzAccessToken -ResourceUrl '(\S+)'(?: -TenantId (\S+))?", decoded_script)
300300
tenant = match[2]
301301

302302
assert tenant is None, "credential shouldn't accept an explicit tenant ID"

0 commit comments

Comments
 (0)