From afa042fdb476db8f1528900a1d6898acb3562baf Mon Sep 17 00:00:00 2001 From: Renato Alves Date: Thu, 11 Jun 2015 01:40:36 +0100 Subject: [PATCH] Tests: Fix due.t failure on cygwin --- test/due.t | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/due.t b/test/due.t index f1a70e478..2a285c8aa 100755 --- a/test/due.t +++ b/test/due.t @@ -36,6 +36,11 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__))) from basetest import Task, TestCase +def timestamp_without_leading_zeros(time): + t = time.strftime("%m/%d/%Y") + return "/".join([x.lstrip("0") for x in t.split("/")]) + + class TestDue(TestCase): def setUp(self): self.t = Task() @@ -49,9 +54,9 @@ class TestDue(TestCase): just = datetime.now() + timedelta(days=3) almost = datetime.now() + timedelta(days=5) - # NOTE: %-m and %-d are unix only - self.just = just.strftime("%-m/%-d/%Y") - self.almost = almost.strftime("%-m/%-d/%Y") + + self.just = timestamp_without_leading_zeros(just) + self.almost = timestamp_without_leading_zeros(almost) self.t(("add", "one", "due:{0}".format(self.just))) self.t(("add", "two", "due:{0}".format(self.almost)))