Skip to content

Commit e440501

Browse files
committed
Test a description beginning with "depends".
See GothenburgBitFactory#733. I don't foresee this being fixable from bugwarrior but could be worked around in taskw. I confirmed that this does pass with ralphbean/taskw#135. I've also confirmed that it passes with now that I've upgraded to taskwarrior-2.6.1. It seems that everyone, including myself, who reproduced this issue in the past was using taskwarrior-2.5.1.
1 parent 75eb709 commit e440501

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

tests/test_db.py

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import copy
2+
import subprocess
23
import unittest
34

45
import taskw.task
@@ -112,6 +113,9 @@ def remove_non_deterministic_keys(tasks: dict) -> dict:
112113
task['tags'] = sorted(task['tags'])
113114
return tasks
114115

116+
def get_tasks(self) -> dict:
117+
return self.remove_non_deterministic_keys(self.tw.load_tasks())
118+
115119
def assertUpdatesEqual(self, updates: dict):
116120
# Make tag order deterministic.
117121
for key in ['new', 'existing', 'changed', 'closed']:
@@ -123,16 +127,14 @@ def assertUpdatesEqual(self, updates: dict):
123127
self.assertEqual(self.synchronizer.updates, updates)
124128

125129
def test_synchronize_integration(self):
126-
def get_tasks() -> dict:
127-
return self.remove_non_deterministic_keys(self.tw.load_tasks())
128130

129131
self.assertEqual(self.tw.load_tasks(), {'completed': [], 'pending': []})
130132

131133
# TEST NEW ISSUE AND EXISTING ISSUE.
132134
for _ in range(2):
133135
db.synchronize(iter((self.issue,)), self.bwconfig, 'general')
134136

135-
self.assertEqual(get_tasks(), {
137+
self.assertEqual(self.get_tasks(), {
136138
'completed': [],
137139
'pending': [{
138140
'project': 'sample_project',
@@ -154,7 +156,7 @@ def get_tasks() -> dict:
154156

155157
db.synchronize(iter((self.issue,)), self.bwconfig, 'general')
156158

157-
self.assertEqual(get_tasks(), {
159+
self.assertEqual(self.get_tasks(), {
158160
'completed': [],
159161
'pending': [{
160162
'priority': 'M',
@@ -239,6 +241,37 @@ def test_duplicate_issues(self):
239241
'closed': []
240242
})
241243

244+
@unittest.skipIf(
245+
subprocess.run(['task', '--version'], capture_output=True).stdout.strip() <= b'2.5.1',
246+
'https://github.com/ralphbean/bugwarrior/issues/733')
247+
def test_synchronize_depends_description(self):
248+
"""
249+
Certain versions of taskwarrior/taskw don't properly handle
250+
descriptions that start with taskwarrior keywords.
251+
252+
See https://github.com/ralphbean/bugwarrior/issues/733.
253+
"""
254+
self.issue['description'] = 'depends filter does not work with IDs'
255+
256+
# Note: In order to test the desired taskwarrior behavior we need to
257+
# actually commit the changes to the database.
258+
db.synchronize(iter((self.issue,)), self.bwconfig, 'general')
259+
260+
self.assertEqual(self.get_tasks(), {
261+
'completed': [],
262+
'pending': [{
263+
'priority': 'M',
264+
'project': 'sample_project',
265+
'status': 'pending',
266+
'description': 'depends filter does not work with IDs',
267+
'githuburl': 'https://example.com',
268+
'githubtype': 'issue',
269+
'id': 1,
270+
'tags': ['foo'],
271+
'urgency': 5.7,
272+
}]
273+
})
274+
242275

243276
class TestUDAs(ConfigTest):
244277
def test_udas(self):

0 commit comments

Comments
 (0)