Comments (8)
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.
Further weirdness, the tests seem to pass fine in travis: https://travis-ci.org/ralphbean/taskw/jobs/36961629
from taskw.
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.
Ugh, so we should probably parse the date we get back and convert back to UTC before asserting.
from taskw.
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.
Sure - does that fix it on your side? I'd be glad to accept a pull request for it.. ;) ;)
from taskw.
here we go :)
from taskw.
Good stuff :)
from taskw.
Related Issues (20)
- get_task() only retrieves single task instead of all matches HOT 2
- UUID parsing of created task fails with recur HOT 1
- taskw in marshaling mode doesn't work with pickle
- Python 3: str(TaskwarriorError(...)): TypeError: __str__ returned non-string (type bytes)
- TypeError: argument of type 'FileNotFoundError' is not iterable
- filter_tasks with multiple uuids HOT 2
- Numeric marshaled values are rounded to the nearest integer HOT 3
- v1.3.0 not uploaded to PyPI HOT 2
- issue adding tasks "UUID has no attribute group" HOT 5
- Unable to update tasks
- `task_add` raises an error, but creates the task HOT 2
- Four test failures on openSUSE Tumbleweed HOT 2
- taskrc includes as relative paths cause FileNotFoundError in taskw
- Fetching a (periodic) task fails - Unable to find report that matches HOT 1
- unnecessary "task --version" 3x to start, 1x for every filter and 2x for every add
- Tag "next" seems not to be added if added as only tag in function add_task HOT 2
- If "annotations" not passed to task_update, it truncates annotations HOT 3
- Marshal=True results in loss of timestamp for annotations.
- Saving task with effort field corrupts the description field.
- Implement a lock file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taskw.