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

Unified Diff: tools/telemetry/telemetry/user_story/user_story_set.py

Issue 725133005: Move serving_dirs to UserStorySet, update user_story_runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comment. Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/telemetry/telemetry/user_story/user_story_runner_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/user_story/user_story_set.py
diff --git a/tools/telemetry/telemetry/user_story/user_story_set.py b/tools/telemetry/telemetry/user_story/user_story_set.py
index d2251bba0b1df3cbca68e07b81aee226b2bbfef0..b4315ffc9e7799afe216fa37bcf115909d0daace 100644
--- a/tools/telemetry/telemetry/user_story/user_story_set.py
+++ b/tools/telemetry/telemetry/user_story/user_story_set.py
@@ -16,7 +16,8 @@ class UserStorySet(object):
AddUserStory for each UserStory..
"""
- def __init__(self, archive_data_file='', cloud_storage_bucket=None):
+ def __init__(self, archive_data_file='', cloud_storage_bucket=None,
+ serving_dirs=None):
"""Creates a new UserStorySet.
Args:
@@ -33,6 +34,9 @@ class UserStorySet(object):
archive_info.AssertValidCloudStorageBucket(cloud_storage_bucket)
self._cloud_storage_bucket = cloud_storage_bucket
self._base_dir = os.path.dirname(inspect.getfile(self.__class__))
+ # Convert any relative serving_dirs to absolute paths.
+ self._serving_dirs = set(os.path.realpath(os.path.join(self.base_dir, d))
+ for d in serving_dirs or [])
@property
def base_dir(self):
@@ -43,6 +47,10 @@ class UserStorySet(object):
return self._base_dir
@property
+ def serving_dirs(self):
+ return self._serving_dirs
+
+ @property
def archive_data_file(self):
return self._archive_data_file
@@ -87,6 +95,15 @@ class UserStorySet(object):
pass
def WprFilePathForUserStory(self, story):
+ """Convenient function to retrive WPR archive file path.
+
+ Args:
+ user_story: The UserStory to lookup.
+
+ Returns:
+ The WPR archive file path for the given UserStory, if found.
+ Otherwise, return None.
+ """
if not self.wpr_archive_info:
return None
return self.wpr_archive_info.WprFilePathForUserStory(story)
« no previous file with comments | « tools/telemetry/telemetry/user_story/user_story_runner_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698