From dad0ac0c27a7aec4e7e4e531837353cdc55bb8b9 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 3 Jan 2015 09:31:54 -0500 Subject: [PATCH] TW-1486 - TW-1486 task wait shows completed tasks which has a wait attribute (thanks to Sujeevan Vijayakumaran). --- AUTHORS | 1 + ChangeLog | 3 +++ src/Task.cpp | 2 +- test/tw-1486.t | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 test/tw-1486.t diff --git a/AUTHORS b/AUTHORS index ea8963a15..dcb282f5e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -240,3 +240,4 @@ suggestions: Arnoud K Ozgur Akgun David Costa + Sujeevan Vijayakumaran diff --git a/ChangeLog b/ChangeLog index 4206a4981..e6a859b1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2.4.1 () - +- TW-1486 task wait shows completed tasks which has a wait attribute (thanks to + Sujeevan Vijayakumaran). + ------ current release --------------------------- 2.4.0 (2015-01-01) 670102842c39bdc62ef84ae4b679a8f5a2d89523 diff --git a/src/Task.cpp b/src/Task.cpp index b0cddb1bd..33f23e8e4 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -1112,10 +1112,10 @@ bool Task::hasTag (const std::string& tag) const if (tag == "SCHEDULED") return has ("scheduled"); if (tag == "CHILD") return has ("parent"); if (tag == "UNTIL") return has ("until"); - if (tag == "WAITING") return has ("wait"); if (tag == "ANNOTATED") return hasAnnotations (); if (tag == "TAGGED") return has ("tags"); if (tag == "PARENT") return has ("mask"); + if (tag == "WAITING") return get ("status") == "waiting"; if (tag == "PENDING") return get ("status") == "pending"; if (tag == "COMPLETED") return get ("status") == "completed"; if (tag == "DELETED") return get ("status") == "deleted"; diff --git a/test/tw-1486.t b/test/tw-1486.t new file mode 100755 index 000000000..5229a18d9 --- /dev/null +++ b/test/tw-1486.t @@ -0,0 +1,34 @@ +#!/usr/bin/env python2.7 +# -*- coding: utf-8 -*- + +import sys +import os +from datetime import datetime +import unittest + +# Ensure python finds the local simpletap module +sys.path.append(os.path.dirname(os.path.abspath(__file__))) + +from basetest import Task, TestCase, Taskd, ServerTestCase + +class Test1486(TestCase): + def setUp(self): + self.t = Task() + + def test_waiting(self): + """Verify waiting report shows waiting tasks""" + self.t.config('uda.sep.type', 'string') + + self.t(('add', 'regular')) + self.t(('add', 'waited', 'wait:later')) + + code, out, err = self.t(('waiting',)) + self.assertEqual(0, code, "Exit code was non-zero ({0})".format(code)) + self.assertIn('waited', out) + self.assertNotIn('regular', out) + +if __name__ == "__main__": + from simpletap import TAPTestRunner + unittest.main(testRunner=TAPTestRunner()) + +# vim: ai sts=4 et sw=4