Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: tests/tools.py

Issue 29501558: Issue 5383 - Add tests for the Chrome and Firefox packagers (Closed)
Patch Set: Created Aug. 4, 2017, 3:06 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5 import os
6 import shutil
7
8
9 def get_leafs_string(tree):
10 """Recursively builds a string, representing the path to all leaf-nodes"""
11 root_str = '{}|{}|{}'.format(tree.tag, tree.tail, tree.text).strip()
12 result = []
13
14 if len(tree) > 0:
15 for subtree in tree:
16 for leaf in get_leafs_string(subtree):
17 result.append('{}__{}'.format(root_str, leaf))
18 else:
19 result.append(root_str)
20 return result
21
22
23 def copy_metadata(filename, tmpdir):
24 path = os.path.join(os.path.dirname(__file__), filename)
25 destination = str(tmpdir.join(filename))
26 shutil.copy(path, destination)
OLDNEW
« tests/test_packagerGecko.py ('K') | « tests/test_packagerGecko.py ('k') | tox.ini » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld