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

Unified Diff: tools/telemetry/telemetry/page/page_set.py

Issue 946473002: Move base_dir to user_story_set, remove file_path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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 | « no previous file | tools/telemetry/telemetry/page/page_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/page_set.py
diff --git a/tools/telemetry/telemetry/page/page_set.py b/tools/telemetry/telemetry/page/page_set.py
index a4ddc1e4206950125cceea161d2f59636235fcd0..e972650817fae3564d69775dd364babd146bd654 100644
--- a/tools/telemetry/telemetry/page/page_set.py
+++ b/tools/telemetry/telemetry/page/page_set.py
@@ -24,19 +24,15 @@ class PageSet(user_story_set.UserStorySet):
serving_dirs=None, bucket=None):
# The default value of file_path is location of the file that define this
# page set instance's class.
- # TODO(chrishenry): Move this logic to user_story_set. Consider passing
- # a base_dir directly. Alternatively, kill this and rely on the default
- # behavior of using the instance's class file location.
- if file_path is None:
- file_path = inspect.getfile(self.__class__)
- # Turn pyc file into py files if we can
- if file_path.endswith('.pyc') and os.path.exists(file_path[:-1]):
- file_path = file_path[:-1]
- self.file_path = file_path
+ # TODO(aiolos): When migrating page_set's over to user_story_set's, make
+ # sure that we are passing a directory, not a file.
+ dir_name = file_path
+ if file_path and os.path.isfile(file_path):
+ dir_name = os.path.dirname(file_path)
super(PageSet, self).__init__(
archive_data_file=archive_data_file, cloud_storage_bucket=bucket,
- serving_dirs=serving_dirs)
+ base_dir=dir_name, serving_dirs=serving_dirs)
# These attributes can be set dynamically by the page set.
self.user_agent_type = user_agent_type
@@ -50,13 +46,6 @@ class PageSet(user_story_set.UserStorySet):
assert user_story.page_set is self
super(PageSet, self).AddUserStory(user_story)
- @property
- def base_dir(self):
- if os.path.isfile(self.file_path):
- return os.path.dirname(self.file_path)
- else:
- return self.file_path
-
def ReorderPageSet(self, results_file):
"""Reorders this page set based on the results of a past run."""
page_set_dict = {}
« no previous file with comments | « no previous file | tools/telemetry/telemetry/page/page_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698