diff --git a/wptrunner/manifestexpected.py b/wptrunner/manifestexpected.py index 7f5231d6af8941..b52e3bc14b3c23 100644 --- a/wptrunner/manifestexpected.py +++ b/wptrunner/manifestexpected.py @@ -54,7 +54,6 @@ def append(self, child): """Add a test to the manifest""" ManifestItem.append(self, child) self.child_map[child.id] = child - assert len(self.child_map) == len(self.children) def _remove_child(self, child): del self.child_map[child.id] diff --git a/wptrunner/manifestupdate.py b/wptrunner/manifestupdate.py index 052de8f8469c25..944b35d7d931f4 100644 --- a/wptrunner/manifestupdate.py +++ b/wptrunner/manifestupdate.py @@ -68,13 +68,13 @@ def __init__(self, node, test_path=None, url_base=None): def append(self, child): ManifestItem.append(self, child) + if child.id in self.child_map: + print "Warning: Duplicate heading %s" % child.id self.child_map[child.id] = child - assert len(self.child_map) == len(self.children) def _remove_child(self, child): del self.child_map[child.id] ManifestItem._remove_child(self, child) - assert len(self.child_map) == len(self.children) def get_test(self, test_id): """Return a TestNode by test id, or None if no test matches diff --git a/wptrunner/metadata.py b/wptrunner/metadata.py index d06727e72bbbb5..f8210227335991 100644 --- a/wptrunner/metadata.py +++ b/wptrunner/metadata.py @@ -65,10 +65,7 @@ def update_expected(test_paths, serve_root, log_file_names, def do_delayed_imports(serve_root): global manifest - - sys.path.insert(0, os.path.join(serve_root)) - sys.path.insert(0, os.path.join(serve_root, "tools", "scripts")) - import manifest + from manifest import manifest def files_in_repo(repo_root): @@ -161,8 +158,14 @@ def write_changes(metadata_path, expected_map): # First write the new manifest files to a temporary directory temp_path = tempfile.mkdtemp(dir=os.path.split(metadata_path)[0]) write_new_expected(temp_path, expected_map) - shutil.copyfile(os.path.join(metadata_path, "MANIFEST.json"), - os.path.join(temp_path, "MANIFEST.json")) + + # Copy all files in the root to the temporary location since + # these cannot be ini files + keep_files = [item for item in os.listdir(metadata_path) if + not os.path.isdir(os.path.join(metadata_path, item))] + for item in keep_files: + shutil.copyfile(os.path.join(metadata_path, item), + os.path.join(temp_path, item)) # Then move the old manifest files to a new location temp_path_2 = metadata_path + str(uuid.uuid4()) @@ -270,7 +273,7 @@ def create_test_tree(metadata_path, test_manifest): expected_map = {} id_test_map = {} exclude_types = frozenset(["stub", "helper", "manual"]) - include_types = set(manifest.item_types) ^ exclude_types + include_types = set(manifest.item_types) - exclude_types for test_path, tests in test_manifest.itertypes(*include_types): expected_data = load_expected(test_manifest, metadata_path, test_path, tests) if expected_data is None: diff --git a/wptrunner/update/metadata.py b/wptrunner/update/metadata.py index 86b85782095e40..34b630df9c168c 100644 --- a/wptrunner/update/metadata.py +++ b/wptrunner/update/metadata.py @@ -52,6 +52,7 @@ def create(self, state): for path in metadata_paths: local_tree.add_new(os.path.relpath(path, local_tree.root)) local_tree.update_patch(include=metadata_paths) + local_tree.commit_patch() class MetadataUpdateRunner(StepRunner):