-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Ensure that tests-affected picks up changes to webidl/idlharness #8069
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,24 @@ def test_files_changed(capsys): | |
assert err == "" | ||
|
||
|
||
def test_files_changed_ignore(): | ||
from tools.wpt.testfiles import exclude_ignored | ||
files = ["resources/testharness.js", "resources/webidl2/index.js", "test/test.js"] | ||
changed, ignored = exclude_ignored(files, ignore_rules=["resources/testharness*"]) | ||
assert changed == [os.path.join(wpt.wpt_root, item) for item in | ||
["resources/webidl2/index.js", "test/test.js"]] | ||
assert ignored == [os.path.join(wpt.wpt_root, item) for item in | ||
["resources/testharness.js"]] | ||
|
||
|
||
def test_files_changed_ignore_rules(): | ||
from tools.wpt.testfiles import compile_ignore_rule | ||
assert compile_ignore_rule("foo*bar*/baz").pattern == "^foo\*bar[^/]*/baz$" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really right? Why is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's just doing prefix matching on path parts. It could do something different, but this is enough to satisfy the current use cases. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, the comment "* before a separator or the end matching" explains this. |
||
assert compile_ignore_rule("foo**bar**/baz").pattern == "^foo\*\*bar.*/baz$" | ||
assert compile_ignore_rule("foobar/baz/*").pattern == "^foobar/baz/[^/]*$" | ||
assert compile_ignore_rule("foobar/baz/**").pattern == "^foobar/baz/.*$" | ||
|
||
|
||
def test_tests_affected(capsys): | ||
# This doesn't really work properly for random commits because we test the files in | ||
# the current working directory for references to the changed files, not the ones at | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing out what the body of this loop does isn't easy, for me. Maybe a test for this that hits each of the branches? (Don't need to apply the rules, just stringify the resulting regexes and asssert that they are what they should be.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests now in
test_files_changed_ignore_rules()