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

Unified Diff: telemetry/telemetry/internal/story_runner_unittest.py

Issue 1806023002: [Telemetry] Re-add API to tear down state after each story run (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: fix test Created 4 years, 9 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
Index: telemetry/telemetry/internal/story_runner_unittest.py
diff --git a/telemetry/telemetry/internal/story_runner_unittest.py b/telemetry/telemetry/internal/story_runner_unittest.py
index 55ac8fdef09ca553b9c59a25e5c8e67265cd5a82..a6cd6cf254d2d1755ed2c3e88d573dc8f80d9ad9 100644
--- a/telemetry/telemetry/internal/story_runner_unittest.py
+++ b/telemetry/telemetry/internal/story_runner_unittest.py
@@ -326,6 +326,30 @@ class StoryRunnerTest(unittest.TestCase):
calls_in_order = GetCallsInOrder() # pylint: disable=no-value-for-parameter
self.assertEquals(EXPECTED_CALLS_IN_ORDER, calls_in_order)
+ def testTearDownStateAfterEachStoryRun(self):
+ class TestSharedStateForTearDown(TestSharedState):
+ num_of_tear_downs = 0
+
+ def RunStory(self, results):
+ pass
+
+ def TearDownState(self):
+ TestSharedStateForTearDown.num_of_tear_downs += 1
+
+ story_set = story_module.StorySet()
+ story_set.AddStory(DummyLocalStory(TestSharedStateForTearDown))
+ story_set.AddStory(DummyLocalStory(TestSharedStateForTearDown))
+ story_set.AddStory(DummyLocalStory(TestSharedStateForTearDown))
+
+ TestSharedStateForTearDown.num_of_tear_downs = 0
+ story_runner.Run(mock.MagicMock(), story_set, self.options, self.results)
+ self.assertEquals(TestSharedStateForTearDown.num_of_tear_downs, 1)
+
+ TestSharedStateForTearDown.num_of_tear_downs = 0
+ story_runner.Run(mock.MagicMock(), story_set, self.options, self.results,
+ should_tear_down_state_after_each_story_run=True)
+ self.assertEquals(TestSharedStateForTearDown.num_of_tear_downs, 3)
+
def testTearDownIsCalledOnceForEachStoryGroupWithPageSetRepeat(self):
self.options.pageset_repeat = 3
fooz_init_call_counter = [0]

Powered by Google App Engine
This is Rietveld 408576698