Skip to content

{CI} Remove unused globals (#31159)

9126f60
Select commit
Loading
Failed to load commit list.
Merged

{LTS} Backport #31159 #31368

{CI} Remove unused globals (#31159)
9126f60
Select commit
Loading
Failed to load commit list.
Azure Pipelines / Azure.azure-cli Full Test failed Apr 27, 2025 in 24m 59s

Build #20250427.19 had test failures

Details

Tests

  • Failed: 24 (0.19%)
  • Passed: 11,084 (87.83%)
  • Other: 1,512 (11.98%)
  • Total: 12,620

Annotations

Check failure on line 2359 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-cli Full Test

Build log #L2359

Bash exited with code '1'.

Check failure on line 2189 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-cli Full Test

Build log #L2189

Bash exited with code '1'.

Check failure on line 2200 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-cli Full Test

Build log #L2200

Bash exited with code '1'.

Check failure on line 2388 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-cli Full Test

Build log #L2388

Bash exited with code '1'.

Check failure on line 1 in test_detect_credential_for_string

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-cli Full Test

test_detect_credential_for_string

self = <azure.cli.core.tests.test_credential_helper.TestCredentialHelper testMethod=test_detect_credential_for_string>

    def test_detect_credential_for_string(self):
        with mock.patch('azure.cli.core.credential_helper.get_secret_masker', side_effect=self._get_test_secret_masker):
            creation_time = '2024-03-07T02:50:56.464790+00:00'
>           containing_credential, _, _ = distinguish_credential(creation_time)

src/azure-cli-core/azure/cli/core/tests/test_credential_helper.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/azure-cli-core/azure/cli/core/credential_helper.py:83: in distinguish_credential
    detections = is_containing_credential(content)
src/azure-cli-core/azure/cli/core/credential_helper.py:44: in is_containing_credential
    return get_secret_masker().detect_secrets(content)
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/secret_masker.py:99: in detect_secrets
    detections.extend(regex_pattern.get_detections(input, self._generate_sha256_hashes))
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/regex_pattern.py:126: in get_detections
    for m in re.finditer(self.pattern, input, self.regex_flags):
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:248: in finditer
    return _compile(pattern, flags).finditer(string)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:304: in _compile
    p = sre_compile.compile(pattern, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_compile.py:788: in compile
    p = sre_parse.parse(p, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:955: in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:444: in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

source = <sre_parse.Tokenizer object at 0x7f5e6b7d81f0>
state = <sre_parse.State object at 0x7f5e6b7d8250>, verbose = 0, nested = 1
first = True

    def _parse(source, state, verbose, nested, first=False):
        # parse a simple pattern
        subpattern = SubPattern(state)
    
        # precompute constants into local variables
        subpatternappend = subpattern.append
        sourceget = source.get
        sourcematch = source.match
        _len = len
        _ord = ord
    
        while True:
    
            this = source.next
            if this is None:
                break # end of pattern
            if this in "|)":
                break # end of subpattern
            sourceget()
    
            if verbose:
                # skip whitespace and comments
                if this in WHITESPACE:
                    continue
                if this == "#":
                    while True:
                        this = sourceget()
                        if this is None or this == "\n":
                            break
                    continue
    
            if this[0] == "\\":
                code = _escape(source, this, state)
                subpatternappend(code)
    
            elif this not in SPECIAL_CHARS:
                subpatternappend((LITERAL, _ord(this)))
    
            elif this == "[":
                here = source.tell() - 1
                # character set
                set = []
                setappend = set.append
    ##          if sourcematch(":"):
    ##              pass # handle character classes
                if source.next == '[':
                    import warnings
                    warnings.warn(
                        'Possible nested set at position %d' % source.tell(),
                        FutureWarning, stacklevel=nested + 6
                    )
                negate = sourcematch("^")
                # check remaining characters
                while True:
                    this = sourceget()
                  
Raw output
self = <azure.cli.core.tests.test_credential_helper.TestCredentialHelper testMethod=test_detect_credential_for_string>

    def test_detect_credential_for_string(self):
        with mock.patch('azure.cli.core.credential_helper.get_secret_masker', side_effect=self._get_test_secret_masker):
            creation_time = '2024-03-07T02:50:56.464790+00:00'
>           containing_credential, _, _ = distinguish_credential(creation_time)

src/azure-cli-core/azure/cli/core/tests/test_credential_helper.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/azure-cli-core/azure/cli/core/credential_helper.py:83: in distinguish_credential
    detections = is_containing_credential(content)
src/azure-cli-core/azure/cli/core/credential_helper.py:44: in is_containing_credential
    return get_secret_masker().detect_secrets(content)
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/secret_masker.py:99: in detect_secrets
    detections.extend(regex_pattern.get_detections(input, self._generate_sha256_hashes))
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/regex_pattern.py:126: in get_detections
    for m in re.finditer(self.pattern, input, self.regex_flags):
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:248: in finditer
    return _compile(pattern, flags).finditer(string)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:304: in _compile
    p = sre_compile.compile(pattern, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_compile.py:788: in compile
    p = sre_parse.parse(p, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:955: in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:444: in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

source = <sre_parse.Tokenizer object at 0x7f5e6b7d81f0>
state = <sre_parse.State object at 0x7f5e6b7d8250>, verbose = 0, nested = 1
first = True

    def _parse(source, state, verbose, nested, first=False):
        # parse a simple pattern
        subpattern = SubPattern(state)
    
        # precompute constants into local variables
        subpatternappend = subpattern.append
        sourceget = source.get
        sourcematch = source.match
        _len = len
        _ord = ord
    
        while True:
    
            this = source.next
            if this is None:
                break # end of pattern
            if this in "|)":
                break # end of subpattern
            sourceget()
    
            if verbose:
                # skip whitespace and comments
                if this in WHITESPACE:
                    continue
                if this == "#":
                    while True:
                        this = sourceget()
                        if this is None or this == "\n":
                            break
                    continue
    
            if this[0] == "\\":
                code = _escape(source, this, state)
                subpatternappend(code)
    
            elif this not in SPECIAL_CHARS:
                subpatternappend((LITERAL, _ord(this)))
    
            elif this == "[":
                here = source.tell() - 1
                # character set
                set = []
                setappend = set.append
    ##          if sourcematch(":"):
    ##              pass # handle character classes
                if source.next == '[':
                    import warnings
                    warnings.warn(
                        'Possible nested set at position %d' % source.tell(),
                        FutureWarning, stacklevel=nested + 6
                    )
                negate = sourcematch("^")
                # check remaining characters
                while True:
                    this = sourceget()
                  

Check failure on line 1 in test_redact_credential_for_json

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-cli Full Test

test_redact_credential_for_json

self = <azure.cli.core.tests.test_credential_helper.TestCredentialHelper testMethod=test_redact_credential_for_json>

    def test_redact_credential_for_json(self):
        content = {
            'tenant': '54826b22-38d6-4fb2-bad9-b7b93a3e9c5a',
            'account_name': 'testaccount',
            'email_address': '[email protected]'
        }
        expected_content = {
            'tenant': '+++',
            'account_name': 'testaccount',
            'email_address': '[email protected]'
        }
        with mock.patch('azure.cli.core.credential_helper.get_secret_masker', side_effect=self._get_test_secret_masker):
>           self.assertEqual(redact_credential(content), expected_content)

src/azure-cli-core/azure/cli/core/tests/test_credential_helper.py:70: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/azure-cli-core/azure/cli/core/credential_helper.py:114: in redact_credential
    content = redact_credential_for_string(content)
src/azure-cli-core/azure/cli/core/credential_helper.py:121: in redact_credential_for_string
    return get_secret_masker().mask_secrets(content)
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/secret_masker.py:119: in mask_secrets
    detections = self.detect_secrets(input)
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/secret_masker.py:99: in detect_secrets
    detections.extend(regex_pattern.get_detections(input, self._generate_sha256_hashes))
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/regex_pattern.py:126: in get_detections
    for m in re.finditer(self.pattern, input, self.regex_flags):
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:248: in finditer
    return _compile(pattern, flags).finditer(string)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:304: in _compile
    p = sre_compile.compile(pattern, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_compile.py:788: in compile
    p = sre_parse.parse(p, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:955: in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:444: in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

source = <sre_parse.Tokenizer object at 0x7f5e6b7db310>
state = <sre_parse.State object at 0x7f5e6b7db370>, verbose = 0, nested = 1
first = True

    def _parse(source, state, verbose, nested, first=False):
        # parse a simple pattern
        subpattern = SubPattern(state)
    
        # precompute constants into local variables
        subpatternappend = subpattern.append
        sourceget = source.get
        sourcematch = source.match
        _len = len
        _ord = ord
    
        while True:
    
            this = source.next
            if this is None:
                break # end of pattern
            if this in "|)":
                break # end of subpattern
            sourceget()
    
            if verbose:
                # skip whitespace and comments
                if this in WHITESPACE:
                    continue
                if this == "#":
                    while True:
                        this = sourceget()
                        if this is None or this == "\n":
                            break
                    continue
    
            if this[0] == "\\":
                code = _escape(source, this, state)
                subpatternappend(code)
    
            elif this not in SPECIAL_CHARS:
                subpatternappend((LITERAL, _ord(this)))
    
            elif this == "[":
                here = source.tell() - 1
                # character set
                set = []
                setappend = set.append
    ##          if sourcematch(":"):
    ##              pass # handle character classes
Raw output
self = <azure.cli.core.tests.test_credential_helper.TestCredentialHelper testMethod=test_redact_credential_for_json>

    def test_redact_credential_for_json(self):
        content = {
            'tenant': '54826b22-38d6-4fb2-bad9-b7b93a3e9c5a',
            'account_name': 'testaccount',
            'email_address': '[email protected]'
        }
        expected_content = {
            'tenant': '+++',
            'account_name': 'testaccount',
            'email_address': '[email protected]'
        }
        with mock.patch('azure.cli.core.credential_helper.get_secret_masker', side_effect=self._get_test_secret_masker):
>           self.assertEqual(redact_credential(content), expected_content)

src/azure-cli-core/azure/cli/core/tests/test_credential_helper.py:70: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/azure-cli-core/azure/cli/core/credential_helper.py:114: in redact_credential
    content = redact_credential_for_string(content)
src/azure-cli-core/azure/cli/core/credential_helper.py:121: in redact_credential_for_string
    return get_secret_masker().mask_secrets(content)
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/secret_masker.py:119: in mask_secrets
    detections = self.detect_secrets(input)
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/secret_masker.py:99: in detect_secrets
    detections.extend(regex_pattern.get_detections(input, self._generate_sha256_hashes))
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/regex_pattern.py:126: in get_detections
    for m in re.finditer(self.pattern, input, self.regex_flags):
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:248: in finditer
    return _compile(pattern, flags).finditer(string)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:304: in _compile
    p = sre_compile.compile(pattern, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_compile.py:788: in compile
    p = sre_parse.parse(p, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:955: in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:444: in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

source = <sre_parse.Tokenizer object at 0x7f5e6b7db310>
state = <sre_parse.State object at 0x7f5e6b7db370>, verbose = 0, nested = 1
first = True

    def _parse(source, state, verbose, nested, first=False):
        # parse a simple pattern
        subpattern = SubPattern(state)
    
        # precompute constants into local variables
        subpatternappend = subpattern.append
        sourceget = source.get
        sourcematch = source.match
        _len = len
        _ord = ord
    
        while True:
    
            this = source.next
            if this is None:
                break # end of pattern
            if this in "|)":
                break # end of subpattern
            sourceget()
    
            if verbose:
                # skip whitespace and comments
                if this in WHITESPACE:
                    continue
                if this == "#":
                    while True:
                        this = sourceget()
                        if this is None or this == "\n":
                            break
                    continue
    
            if this[0] == "\\":
                code = _escape(source, this, state)
                subpatternappend(code)
    
            elif this not in SPECIAL_CHARS:
                subpatternappend((LITERAL, _ord(this)))
    
            elif this == "[":
                here = source.tell() - 1
                # character set
                set = []
                setappend = set.append
    ##          if sourcematch(":"):
    ##              pass # handle character classes

Check failure on line 1 in test_redact_credential_for_string

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-cli Full Test

test_redact_credential_for_string

self = <azure.cli.core.tests.test_credential_helper.TestCredentialHelper testMethod=test_redact_credential_for_string>

    def test_redact_credential_for_string(self):
        with mock.patch('azure.cli.core.credential_helper.get_secret_masker', side_effect=self._get_test_secret_masker):
            creation_time = '2024-03-07T02:50:56.464790+00:00'
>           result = redact_credential_for_string(creation_time)

src/azure-cli-core/azure/cli/core/tests/test_credential_helper.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/azure-cli-core/azure/cli/core/credential_helper.py:121: in redact_credential_for_string
    return get_secret_masker().mask_secrets(content)
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/secret_masker.py:119: in mask_secrets
    detections = self.detect_secrets(input)
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/secret_masker.py:99: in detect_secrets
    detections.extend(regex_pattern.get_detections(input, self._generate_sha256_hashes))
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/regex_pattern.py:126: in get_detections
    for m in re.finditer(self.pattern, input, self.regex_flags):
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:248: in finditer
    return _compile(pattern, flags).finditer(string)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:304: in _compile
    p = sre_compile.compile(pattern, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_compile.py:788: in compile
    p = sre_parse.parse(p, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:955: in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:444: in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

source = <sre_parse.Tokenizer object at 0x7f5e6b7db430>
state = <sre_parse.State object at 0x7f5e6b7db490>, verbose = 0, nested = 1
first = True

    def _parse(source, state, verbose, nested, first=False):
        # parse a simple pattern
        subpattern = SubPattern(state)
    
        # precompute constants into local variables
        subpatternappend = subpattern.append
        sourceget = source.get
        sourcematch = source.match
        _len = len
        _ord = ord
    
        while True:
    
            this = source.next
            if this is None:
                break # end of pattern
            if this in "|)":
                break # end of subpattern
            sourceget()
    
            if verbose:
                # skip whitespace and comments
                if this in WHITESPACE:
                    continue
                if this == "#":
                    while True:
                        this = sourceget()
                        if this is None or this == "\n":
                            break
                    continue
    
            if this[0] == "\\":
                code = _escape(source, this, state)
                subpatternappend(code)
    
            elif this not in SPECIAL_CHARS:
                subpatternappend((LITERAL, _ord(this)))
    
            elif this == "[":
                here = source.tell() - 1
                # character set
                set = []
                setappend = set.append
    ##          if sourcematch(":"):
    ##              pass # handle character classes
                if source.next == '[':
                    import warnings
                    warnings.warn(
                        'Possible nested set at position %d' % source.tell(),
                        FutureWarning, stacklevel=nested + 6
                    )
                negate = sourcematch("^")
                # check remaining characters
                while True:
                    this = sourceget()
         
Raw output
self = <azure.cli.core.tests.test_credential_helper.TestCredentialHelper testMethod=test_redact_credential_for_string>

    def test_redact_credential_for_string(self):
        with mock.patch('azure.cli.core.credential_helper.get_secret_masker', side_effect=self._get_test_secret_masker):
            creation_time = '2024-03-07T02:50:56.464790+00:00'
>           result = redact_credential_for_string(creation_time)

src/azure-cli-core/azure/cli/core/tests/test_credential_helper.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/azure-cli-core/azure/cli/core/credential_helper.py:121: in redact_credential_for_string
    return get_secret_masker().mask_secrets(content)
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/secret_masker.py:119: in mask_secrets
    detections = self.detect_secrets(input)
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/secret_masker.py:99: in detect_secrets
    detections.extend(regex_pattern.get_detections(input, self._generate_sha256_hashes))
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/regex_pattern.py:126: in get_detections
    for m in re.finditer(self.pattern, input, self.regex_flags):
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:248: in finditer
    return _compile(pattern, flags).finditer(string)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:304: in _compile
    p = sre_compile.compile(pattern, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_compile.py:788: in compile
    p = sre_parse.parse(p, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:955: in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:444: in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

source = <sre_parse.Tokenizer object at 0x7f5e6b7db430>
state = <sre_parse.State object at 0x7f5e6b7db490>, verbose = 0, nested = 1
first = True

    def _parse(source, state, verbose, nested, first=False):
        # parse a simple pattern
        subpattern = SubPattern(state)
    
        # precompute constants into local variables
        subpatternappend = subpattern.append
        sourceget = source.get
        sourcematch = source.match
        _len = len
        _ord = ord
    
        while True:
    
            this = source.next
            if this is None:
                break # end of pattern
            if this in "|)":
                break # end of subpattern
            sourceget()
    
            if verbose:
                # skip whitespace and comments
                if this in WHITESPACE:
                    continue
                if this == "#":
                    while True:
                        this = sourceget()
                        if this is None or this == "\n":
                            break
                    continue
    
            if this[0] == "\\":
                code = _escape(source, this, state)
                subpatternappend(code)
    
            elif this not in SPECIAL_CHARS:
                subpatternappend((LITERAL, _ord(this)))
    
            elif this == "[":
                here = source.tell() - 1
                # character set
                set = []
                setappend = set.append
    ##          if sourcematch(":"):
    ##              pass # handle character classes
                if source.next == '[':
                    import warnings
                    warnings.warn(
                        'Possible nested set at position %d' % source.tell(),
                        FutureWarning, stacklevel=nested + 6
                    )
                negate = sourcematch("^")
                # check remaining characters
                while True:
                    this = sourceget()
         

Check failure on line 1 in test_detect_credential_for_string

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-cli Full Test

test_detect_credential_for_string

self = <azure.cli.core.tests.test_credential_helper.TestCredentialHelper testMethod=test_detect_credential_for_string>

    def test_detect_credential_for_string(self):
        with mock.patch('azure.cli.core.credential_helper.get_secret_masker', side_effect=self._get_test_secret_masker):
            creation_time = '2024-03-07T02:50:56.464790+00:00'
>           containing_credential, _, _ = distinguish_credential(creation_time)

src/azure-cli-core/azure/cli/core/tests/test_credential_helper.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/azure-cli-core/azure/cli/core/credential_helper.py:83: in distinguish_credential
    detections = is_containing_credential(content)
src/azure-cli-core/azure/cli/core/credential_helper.py:44: in is_containing_credential
    return get_secret_masker().detect_secrets(content)
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/secret_masker.py:99: in detect_secrets
    detections.extend(regex_pattern.get_detections(input, self._generate_sha256_hashes))
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/regex_pattern.py:126: in get_detections
    for m in re.finditer(self.pattern, input, self.regex_flags):
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:248: in finditer
    return _compile(pattern, flags).finditer(string)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:304: in _compile
    p = sre_compile.compile(pattern, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_compile.py:788: in compile
    p = sre_parse.parse(p, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:955: in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:444: in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

source = <sre_parse.Tokenizer object at 0x7f0aa548dd90>
state = <sre_parse.State object at 0x7f0aa548ddf0>, verbose = 0, nested = 1
first = True

    def _parse(source, state, verbose, nested, first=False):
        # parse a simple pattern
        subpattern = SubPattern(state)
    
        # precompute constants into local variables
        subpatternappend = subpattern.append
        sourceget = source.get
        sourcematch = source.match
        _len = len
        _ord = ord
    
        while True:
    
            this = source.next
            if this is None:
                break # end of pattern
            if this in "|)":
                break # end of subpattern
            sourceget()
    
            if verbose:
                # skip whitespace and comments
                if this in WHITESPACE:
                    continue
                if this == "#":
                    while True:
                        this = sourceget()
                        if this is None or this == "\n":
                            break
                    continue
    
            if this[0] == "\\":
                code = _escape(source, this, state)
                subpatternappend(code)
    
            elif this not in SPECIAL_CHARS:
                subpatternappend((LITERAL, _ord(this)))
    
            elif this == "[":
                here = source.tell() - 1
                # character set
                set = []
                setappend = set.append
    ##          if sourcematch(":"):
    ##              pass # handle character classes
                if source.next == '[':
                    import warnings
                    warnings.warn(
                        'Possible nested set at position %d' % source.tell(),
                        FutureWarning, stacklevel=nested + 6
                    )
                negate = sourcematch("^")
                # check remaining characters
                while True:
                    this = sourceget()
                  
Raw output
self = <azure.cli.core.tests.test_credential_helper.TestCredentialHelper testMethod=test_detect_credential_for_string>

    def test_detect_credential_for_string(self):
        with mock.patch('azure.cli.core.credential_helper.get_secret_masker', side_effect=self._get_test_secret_masker):
            creation_time = '2024-03-07T02:50:56.464790+00:00'
>           containing_credential, _, _ = distinguish_credential(creation_time)

src/azure-cli-core/azure/cli/core/tests/test_credential_helper.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/azure-cli-core/azure/cli/core/credential_helper.py:83: in distinguish_credential
    detections = is_containing_credential(content)
src/azure-cli-core/azure/cli/core/credential_helper.py:44: in is_containing_credential
    return get_secret_masker().detect_secrets(content)
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/secret_masker.py:99: in detect_secrets
    detections.extend(regex_pattern.get_detections(input, self._generate_sha256_hashes))
env/lib/python3.9/site-packages/microsoft_security_utilities_secret_masker/regex_pattern.py:126: in get_detections
    for m in re.finditer(self.pattern, input, self.regex_flags):
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:248: in finditer
    return _compile(pattern, flags).finditer(string)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/re.py:304: in _compile
    p = sre_compile.compile(pattern, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_compile.py:788: in compile
    p = sre_parse.parse(p, flags)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:955: in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/sre_parse.py:444: in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

source = <sre_parse.Tokenizer object at 0x7f0aa548dd90>
state = <sre_parse.State object at 0x7f0aa548ddf0>, verbose = 0, nested = 1
first = True

    def _parse(source, state, verbose, nested, first=False):
        # parse a simple pattern
        subpattern = SubPattern(state)
    
        # precompute constants into local variables
        subpatternappend = subpattern.append
        sourceget = source.get
        sourcematch = source.match
        _len = len
        _ord = ord
    
        while True:
    
            this = source.next
            if this is None:
                break # end of pattern
            if this in "|)":
                break # end of subpattern
            sourceget()
    
            if verbose:
                # skip whitespace and comments
                if this in WHITESPACE:
                    continue
                if this == "#":
                    while True:
                        this = sourceget()
                        if this is None or this == "\n":
                            break
                    continue
    
            if this[0] == "\\":
                code = _escape(source, this, state)
                subpatternappend(code)
    
            elif this not in SPECIAL_CHARS:
                subpatternappend((LITERAL, _ord(this)))
    
            elif this == "[":
                here = source.tell() - 1
                # character set
                set = []
                setappend = set.append
    ##          if sourcematch(":"):
    ##              pass # handle character classes
                if source.next == '[':
                    import warnings
                    warnings.warn(
                        'Possible nested set at position %d' % source.tell(),
                        FutureWarning, stacklevel=nested + 6
                    )
                negate = sourcematch("^")
                # check remaining characters
                while True:
                    this = sourceget()