Tests: Fix due.t failure on cygwin

This commit is contained in:
Renato Alves 2015-06-11 01:40:36 +01:00
parent f152d14baa
commit afa042fdb4

View file

@ -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)))