Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: tools/tests/licenses_test.py

Issue 2802723004: Fix an issue that tools/license.py fails when BUILD.gn is not directly (Closed)
Patch Set: Apply review comments. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/tests/OWNERS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2017 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Unit tests for //tools/licenses.py.
7 """
8
9 import os
10 import sys
11 import unittest
12
13 REPOSITORY_ROOT = os.path.abspath(os.path.join(
14 os.path.dirname(__file__), '..', '..'))
15 sys.path.append(os.path.join(REPOSITORY_ROOT, 'tools'))
16
17 import licenses
18
19
20 class LicensesTest(unittest.TestCase):
21
22 def test_get_third_party_deps_from_gn_deps_output(self):
23 third_party_deps = licenses.GetThirdPartyDepsFromGNDepsOutput(
24 '/home/example/src/net/BUILD.gn\n'
25 '/home/example/src/third_party/zlib/BUILD.gn\n'
26 '/home/example/src/third_party/cld_3/src/src/BUILD.gn\n')
27
28 # '/home/example/src/net' is not in the output because it's not a
29 # third_party dependency.
30 #
31 # It must return the direct sub-directory of "third_party". So it should
32 # return '/home/example/src/third_party/cld_3', not
33 # '/home/example/src/third_party/cld_3/src/src'.
34 assert third_party_deps == set([
35 '/home/example/src/third_party/zlib',
36 '/home/example/src/third_party/cld_3',
37 ])
38
39
40 if __name__ == '__main__':
41 unittest.main()
OLDNEW
« no previous file with comments | « tools/tests/OWNERS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698