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

Unified Diff: tools/push-to-trunk/common_includes.py

Issue 98173003: Mock out date call in push-to-trunk script for testability. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « no previous file | tools/push-to-trunk/push_to_trunk.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/push-to-trunk/common_includes.py
diff --git a/tools/push-to-trunk/common_includes.py b/tools/push-to-trunk/common_includes.py
index a2f0748f509be54ae8c3091b8529793a3787410f..ba23314e070bad39fe71a9b7fc4afb2de1c5b987 100644
--- a/tools/push-to-trunk/common_includes.py
+++ b/tools/push-to-trunk/common_includes.py
@@ -26,6 +26,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import datetime
import os
import re
import subprocess
@@ -202,9 +203,12 @@ class SideEffectHandler(object):
finally:
url_fh.close()
- def Sleep(seconds):
+ def Sleep(self, seconds):
time.sleep(seconds)
+ def GetDate(self):
+ return datetime.date.today().strftime("%Y-%m-%d")
+
DEFAULT_SIDE_EFFECT_HANDLER = SideEffectHandler()
@@ -286,6 +290,9 @@ class Step(object):
cmd = lambda: self._side_effect_handler.ReadURL(url)
return self.Retry(cmd, retry_on, wait_plan)
+ def GetDate(self):
+ return self._side_effect_handler.GetDate()
+
def Die(self, msg=""):
if msg != "":
print "Error: %s" % msg
« no previous file with comments | « no previous file | tools/push-to-trunk/push_to_trunk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698