blob: f4aab9a57e22b70cf77512ad2bacc1f3ddf09dd5 [file] [log] [blame]
Kuang-che Wu2ea804f2017-11-28 17:11:41 +08001# 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
6from __future__ import print_function
7import os
8
9
10def 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