Allow running wpt directories by path on the command line.

This commit is contained in:
Josh Matthews 2017-06-21 13:46:28 -04:00 committed by Ms2ger
parent ca340eca39
commit 933b42ef46
2 changed files with 11 additions and 1 deletions

View file

@ -51,6 +51,15 @@ class Manifest(object):
for test in type_tests.get(path, set()):
yield test
def iterdir(self, dir_name):
if not dir_name.endswith(os.path.sep):
dir_name = dir_name + os.path.sep
for type_tests in self._data.values():
for path, tests in type_tests.iteritems():
if path.startswith(dir_name):
for test in tests:
yield test
@property
def reftest_nodes_by_url(self):
if self._reftest_nodes_by_url is None:

View file

@ -93,7 +93,8 @@ class IncludeManifest(ManifestItem):
for manifest, data in test_manifests.iteritems():
found = False
rel_path = os.path.relpath(path, data["tests_path"])
for test in manifest.iterpath(rel_path):
iterator = manifest.iterpath if os.path.isfile(path) else manifest.iterdir
for test in iterator(rel_path):
if not hasattr(test, "url"):
continue
url = test.url