Skip to content

Commit

Permalink
Merge pull request #79 from w3c/update_fixups
Browse files Browse the repository at this point in the history
Fix update script with reftest changes
  • Loading branch information
jgraham committed Mar 3, 2015
2 parents c0aa579 + 13b1475 commit 3a1c03b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
1 change: 0 additions & 1 deletion wptrunner/manifestexpected.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions wptrunner/manifestupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 10 additions & 7 deletions wptrunner/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions wptrunner/update/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 3a1c03b

Please sign in to comment.