Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional test cases for pattern matching in test_match.py which fail today. #491

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sfc-gh-dsada
Copy link

This pull request focuses on enhancing the test coverage for the test_match and test_match_any functions in the tests/unit/utils/test_match.py file. The changes introduce a variety of new test cases to ensure the matching logic is thoroughly validated.

Enhancements to test coverage:

  • tests/unit/utils/test_match.py: Added multiple new test cases to test_match to cover various pattern matching scenarios, including folder paths, file extensions, and exclusion patterns.
  • tests/unit/utils/test_match.py: Added new test cases to test_match_any to validate the matching logic with different patterns and inputs, including exception handling.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@sfc-gh-dsada sfc-gh-dsada marked this pull request as ready for review January 27, 2025 23:40
Copy link
Contributor

@joseph-sentry joseph-sentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function in particular shouldn't receive globs, and should only receive regexes. this is because during the commit_yaml validation certain fields are transformed, see:

def _normalize_coerce_regexify_path_pattern(self, value):
return PathPatternSchemaField().validate(value)

path_list_structure = {
"type": "list",
"nullable": True,
"schema": {"type": "string", "coerce": "regexify_path_pattern"},
}

component_rule_basic_properties = {
"statuses": {
"type": "list",
"schema": {"type": "dict", "schema": component_status_attributes},
},
"flag_regexes": {"type": "list", "schema": {"type": "string"}},
"paths": path_list_structure,
}

the tests for the function that transforms the globs into regexes is here:

class TestGlobToRegexTranslation(BaseTestCase):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants