Kuang-che Wu | 2ea804f | 2017-11-28 17:11:41 +0800 | [diff] [blame] | 1 | # Copyright 2017 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | """Common functions for testing""" |
| 5 | |
| 6 | from __future__ import print_function |
| 7 | import os |
| 8 | |
| 9 | |
| 10 | def get_testdata_path(filename=None): |
| 11 | """Get path to test data |
| 12 | |
| 13 | Args: |
| 14 | filename: path relative to the test data folder. |
| 15 | |
| 16 | Returns: |
| 17 | path to the file inside test data folder. If filename is None, the path of |
| 18 | test data folder is returned. |
| 19 | """ |
| 20 | path = os.path.join(os.path.dirname(__file__), '..', 'testdata') |
| 21 | if filename: |
| 22 | path = os.path.join(path, filename) |
| 23 | return path |