mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Nag based on task state before modification
With this patch, taskwarrior uses the urgency of tasks before any modifications are applied when deciding whether to show nag messages. Previously, taskwarrior would apply modifications before deciding whether to show nag messages, which could lead to spurious nag messages when completing an active task.
This commit is contained in:
parent
607baa081d
commit
b33a99a748
5 changed files with 98 additions and 33 deletions
64
test/nag.t
64
test/nag.t
|
@ -91,6 +91,70 @@ class TestNagging(TestCase):
|
|||
code, out, err = self.t("1 done")
|
||||
self.assertNotIn("NAG", err)
|
||||
|
||||
def test_nagging_bulk(self):
|
||||
"""Verify that only one nag message occurs when completing multiple tasks"""
|
||||
self.t("add one")
|
||||
self.t.faketime("+1d")
|
||||
self.t("add two")
|
||||
self.t("add two")
|
||||
|
||||
code, out, err = self.t("2 done")
|
||||
|
||||
self.assertEqual(err.count("NAG"), 1)
|
||||
|
||||
def test_nagging_active(self):
|
||||
"""Bug 2163: Verify that nagging does not occur when completing the most urgent active task"""
|
||||
self.t("add one")
|
||||
self.t.faketime("+1d")
|
||||
self.t("add two")
|
||||
self.t("2 start")
|
||||
|
||||
code, out, err = self.t("2 done")
|
||||
|
||||
# Taskwarrior should not nag about more urgent tasks
|
||||
self.assertNotIn("NAG", err)
|
||||
|
||||
def test_nagging_start_only_task(self):
|
||||
"""Verify that nagging does not occur when there are no other tasks while starting a task"""
|
||||
self.t("add one")
|
||||
|
||||
code, out, err = self.t("1 start")
|
||||
|
||||
self.assertNotIn("NAG", err)
|
||||
|
||||
def test_nagging_start(self):
|
||||
"""Verify that nagging occurs when there are READY tasks of higher urgency while starting a task"""
|
||||
self.t("add one")
|
||||
self.t.faketime("+10d")
|
||||
self.t("add two")
|
||||
|
||||
code, out, err = self.t("2 start")
|
||||
|
||||
self.assertIn("NAG", err)
|
||||
|
||||
def test_nagging_nonag(self):
|
||||
"""Verify that nagging does not occur when a task has the nonag tag"""
|
||||
self.t("add one +other")
|
||||
self.t.faketime("+10d")
|
||||
self.t("add two +nonag")
|
||||
|
||||
code, out, err = self.t("2 done")
|
||||
|
||||
self.assertNotIn("NAG", err)
|
||||
|
||||
def test_nagging_nonag_bulk(self):
|
||||
"""Verify that nagging occurs even if some tasks in a bulk operation have a nonag tag"""
|
||||
self.t("add one +other")
|
||||
self.t.faketime("+10d")
|
||||
self.t("add two +other")
|
||||
self.t.faketime("+10d")
|
||||
self.t("add three +nonag")
|
||||
|
||||
code, out, err = self.t("2-3 done")
|
||||
|
||||
self.assertIn("NAG", err)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from simpletap import TAPTestRunner
|
||||
unittest.main(testRunner=TAPTestRunner())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue