Giter Club home page Giter Club logo

Comments (8)

ralphbean avatar ralphbean commented on June 2, 2024

Weird. I only have a task-2.4 setup to test with currently (which doesn't work -- but I've been trying to get it working), but I could've sworn we left the task-2.3 stuff in a working state.

I don't suppose you could add in some print statements so we can see what tasks['pending'][0]['entry'] and task['somedate'] look like, could you?

from taskw.

ralphbean avatar ralphbean commented on June 2, 2024

Further weirdness, the tests seem to pass fine in travis: https://travis-ci.org/ralphbean/taskw/jobs/36961629

from taskw.

dev-zero avatar dev-zero commented on June 2, 2024

It seems to be a timezone issue. Adding a print statement in line 192 of taskw/test/test_datas.py gives me:

..............................F.F...............................................................................................
======================================================================
FAIL: taskw.test.test_datas.TestDBShellout.test_add_datetime
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.3/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/tiziano/work/gentoo/scratch/taskw/taskw/test/test_datas.py", line 193, in test_add_datetime
    assert(tasks['pending'][0]['entry'].startswith("20110101T"))
nose.proxy.AssertionError: 
-------------------- >> begin captured stdout << ---------------------
20101231T230000Z

--------------------- >> end captured stdout << ----------------------

and I am at UTC+1, so 2011-01-01:00:00:00 (local) corresponds to 2010-12-31:23:00:00 (UTC).

from taskw.

ralphbean avatar ralphbean commented on June 2, 2024

Ugh, so we should probably parse the date we get back and convert back to UTC before asserting.

from taskw.

dev-zero avatar dev-zero commented on June 2, 2024

or specify the time in UTC?:

diff --git a/taskw/test/test_datas.py b/taskw/test/test_datas.py
index 22c276a..8211f16 100644
--- a/taskw/test/test_datas.py
+++ b/taskw/test/test_datas.py
@@ -5,6 +5,7 @@ import sys
 import shutil
 import tempfile
 import datetime
+import dateutil.tz

 from taskw import TaskWarriorDirect, TaskWarriorShellout

@@ -183,12 +184,13 @@ class _BaseTestDB(object):
             "foobar",
             uuid="1234-1234",
             project="some_project",
-            entry=datetime.datetime(2011, 1, 1),
+            entry=datetime.datetime(2011, 1, 1, tzinfo=dateutil.tz.tzutc()),
         )
         tasks = self.tw.load_tasks()
         eq_(len(tasks['pending']), 1)
         # The exact string we get back is dependent on your current TZ
         # ... we'll just "roughly" test it instead of mocking.
+        print(tasks['pending'][0]['entry'])
         assert(tasks['pending'][0]['entry'].startswith("20110101T"))

     def test_add_with_uda_string(self):
@@ -205,7 +207,7 @@ class _BaseTestDB(object):
     def test_add_with_uda_date(self):
         self.tw.task_add(
             "foobar",
-            somedate=datetime.datetime(2011, 1, 1),
+            somedate=datetime.datetime(2011, 1, 1, tzinfo=dateutil.tz.tzutc()),
         )
         tasks = self.tw.load_tasks()
         eq_(len(tasks['pending']), 1)

from taskw.

ralphbean avatar ralphbean commented on June 2, 2024

Sure - does that fix it on your side? I'd be glad to accept a pull request for it.. ;) ;)

from taskw.

dev-zero avatar dev-zero commented on June 2, 2024

here we go :)

from taskw.

ralphbean avatar ralphbean commented on June 2, 2024

Good stuff :)

from taskw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.