Chromium Code Reviews| Index: tools/release/test_update_node.py |
| diff --git a/tools/release/test_update_node.py b/tools/release/test_update_node.py |
| index f9311a86e39e0afeb2ef5e361779f6eef30d1fb0..20bedbf4207fb7f921591a455cd37254b6fcf036 100755 |
| --- a/tools/release/test_update_node.py |
| +++ b/tools/release/test_update_node.py |
| @@ -29,6 +29,14 @@ EXPECTED_GITIGNORE = """ |
| /unrelated |
| """ |
| +EXPECTED_GIT_DIFF = """ |
| + rename deps/v8/baz/{delete_me => v8_new} (100%) |
| + rename deps/v8/{delete_me => new/v8_new} (100%) |
| + create mode 100644 deps/v8/third_party/jinja2/jinja2 |
| + create mode 100644 deps/v8/third_party/markupsafe/markupsafe |
| + create mode 100644 deps/v8/v8_new |
| +""" |
| + |
| ADDED_FILES = [ |
| 'v8_new', |
| 'new/v8_new', |
| @@ -51,7 +59,7 @@ def gitify(path): |
| files = os.listdir(path) |
| subprocess.check_call(['git', 'init'], cwd=path) |
| subprocess.check_call(['git', 'add'] + files, cwd=path) |
| - subprocess.check_call(['git', 'commit', '-m="Initial"'], cwd=path) |
| + subprocess.check_call(['git', 'commit', '-m', 'Initial'], cwd=path) |
| class TestUpdateNode(unittest.TestCase): |
| @@ -71,11 +79,12 @@ class TestUpdateNode(unittest.TestCase): |
| for repository in update_node.SUB_REPOSITORIES: |
| gitify(os.path.join(v8_cwd, *repository)) |
| - # Set up node test fixture (no git repo required). |
| + # Set up node test fixture. |
| shutil.copytree(src=os.path.join(TEST_DATA, 'node'), dst=node_cwd) |
| + gitify(os.path.join(node_cwd)) |
| # Run update script. |
| - update_node.Main([v8_cwd, node_cwd]) |
| + update_node.Main([v8_cwd, node_cwd, "--commit"]) |
| # Check expectations. |
| with open(os.path.join(node_cwd, 'deps', 'v8', '.gitignore')) as f: |
| @@ -87,6 +96,10 @@ class TestUpdateNode(unittest.TestCase): |
| for f in REMOVED_FILES: |
| removed_file = os.path.join(node_cwd, 'deps', 'v8', *f.split('/')) |
| self.assertFalse(os.path.exists(removed_file)) |
| + process = subprocess.Popen(['git', 'diff', 'master', '--summary'], |
|
Michael Achenbach
2017/03/14 10:50:42
Maybe just use subprocess.check_output for such si
Yang
2017/03/14 12:42:19
Done.
|
| + cwd=node_cwd, stdout=subprocess.PIPE) |
| + gitlog, error = process.communicate() |
| + self.assertEquals(EXPECTED_GIT_DIFF.strip(), gitlog.strip()) |
| if __name__ == "__main__": |
| unittest.main() |