diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-07-17 00:18:45 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-07-17 00:21:31 +0200 |
commit | b29d15dec890f1defd99a792c28d3a1f576847e0 (patch) | |
tree | d1d5c2b3ec713ede7b432110997ab24b483d1dee /uitest | |
parent | 5f5575f8c4f7766db0c7468a03ce1bed46821cfd (diff) |
uitest: don't hard code my path in test
Change-Id: I65959552f74d860ee8773f1f5649bd160686f288
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/demo_ui/handle_multiple_files.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/uitest/demo_ui/handle_multiple_files.py b/uitest/demo_ui/handle_multiple_files.py index cc36baffdaf0..9fdcd8627302 100644 --- a/uitest/demo_ui/handle_multiple_files.py +++ b/uitest/demo_ui/handle_multiple_files.py @@ -13,14 +13,24 @@ from uitest.framework import UITestCase from uitest.debug import sleep import time +import os +import pathlib + +def get_data_dir(): + current_dir = os.path.dirname(os.path.realpath(__file__)) + return os.path.join(current_dir, "data") + +def get_url_for_data_file(file_name): + path = os.path.join(get_data_dir(), file_name) + return pathlib.Path(path).as_uri() class HandleFiles(UITestCase): def test_load_file(self): - calc_file = self.ui_test.load_file("file:///home/moggi/devel/libo9/uitest/data/test.ods") + calc_file = self.ui_test.load_file(get_url_for_data_file("test.ods")) - calc_file2 = self.ui_test.load_file("file:///home/moggi/devel/libo9/uitest/data/test2.ods") + calc_file2 = self.ui_test.load_file(get_url_for_data_file("test2.ods")) frames = self.ui_test.get_frames() self.assertEqual(len(frames), 2) |