Skip to content

Commit

Permalink
test: add --test-root option to test.py
Browse files Browse the repository at this point in the history
This way we can specify a custom path for the test folder, e.g.
when building addons separately from the source tree.

PR-URL: #26093
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
hashseed authored and addaleax committed Feb 17, 2019
1 parent e13ce0f commit 91f8814
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,8 @@ def BuildOptions():
default="")
result.add_option('--temp-dir',
help='Optional path to change directory used for tests', default=False)
result.add_option('--test-root',
help='Optional path to change test directory', dest='test_root', default=None)
result.add_option('--repeat',
help='Number of times to repeat given tests',
default=1, type="int")
Expand Down Expand Up @@ -1576,8 +1578,10 @@ def Main():

workspace = abspath(join(dirname(sys.argv[0]), '..'))
test_root = join(workspace, 'test')
if options.test_root is not None:
test_root = options.test_root
suites = GetSuites(test_root)
repositories = [TestRepository(join(workspace, 'test', name)) for name in suites]
repositories = [TestRepository(join(test_root, name)) for name in suites]
repositories += [TestRepository(a) for a in options.suite]

root = LiteralTestSuite(repositories, test_root)
Expand Down

0 comments on commit 91f8814

Please sign in to comment.