mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Merge branch '2.4.0' of ssh://git.tasktools.org/tm/task into 2.4.0
This commit is contained in:
commit
9ad5502ad5
5 changed files with 24 additions and 34 deletions
|
@ -83,7 +83,8 @@ class BaseTestCase(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def callTask(self, args, input=None, merge_streams=True):
|
@classmethod
|
||||||
|
def callTask(cls, args, input=None, merge_streams=True):
|
||||||
"""Invoke src/task with the given arguments
|
"""Invoke src/task with the given arguments
|
||||||
|
|
||||||
Use callTaskSuccess or callTaskError if you want exit_code to be tested
|
Use callTaskSuccess or callTaskError if you want exit_code to be tested
|
||||||
|
@ -122,7 +123,8 @@ class BaseTestCase(unittest.TestCase):
|
||||||
|
|
||||||
return p.returncode, out, err
|
return p.returncode, out, err
|
||||||
|
|
||||||
def callTaskSuccess(self, args, input=None, merge_streams=True):
|
@classmethod
|
||||||
|
def callTaskSuccess(cls, args, input=None, merge_streams=True):
|
||||||
"""Invoke src/task with the given arguments and expect a zero exit
|
"""Invoke src/task with the given arguments and expect a zero exit
|
||||||
code.
|
code.
|
||||||
Causes test to fail if exit_code != 0
|
Causes test to fail if exit_code != 0
|
||||||
|
@ -134,13 +136,14 @@ class BaseTestCase(unittest.TestCase):
|
||||||
|
|
||||||
Returns (exit_code, stdout, stderr)
|
Returns (exit_code, stdout, stderr)
|
||||||
"""
|
"""
|
||||||
out = self.callTask(args, input, merge_streams)
|
out = cls.callTask(args, input, merge_streams)
|
||||||
|
|
||||||
self.assertEqual(out[0], 0, "Task finished with non-zero ({0}) exit "
|
assert out[0] == 0, ("Task finished with non-zero ({0}) exit code\n"
|
||||||
"code".format(out[0]))
|
"OUTPUT: {1}".format(out[0], out[1]))
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def callTaskError(self, args, input=None, merge_streams=True):
|
@classmethod
|
||||||
|
def callTaskError(cls, args, input=None, merge_streams=True):
|
||||||
"""Invoke src/task with the given arguments and expect a non-zero exit
|
"""Invoke src/task with the given arguments and expect a non-zero exit
|
||||||
code.
|
code.
|
||||||
Causes test to fail if exit_code == 0
|
Causes test to fail if exit_code == 0
|
||||||
|
@ -152,9 +155,9 @@ class BaseTestCase(unittest.TestCase):
|
||||||
|
|
||||||
Returns (exit_code, stdout, stderr)
|
Returns (exit_code, stdout, stderr)
|
||||||
"""
|
"""
|
||||||
out = self.callTask(args, input, merge_streams)
|
out = cls.callTask(args, input, merge_streams)
|
||||||
|
|
||||||
self.assertNotEqual(out[0], 0, "Task finished with zero exit (0) code")
|
assert out[0] != 0, "Task finished with zero exit (0) code"
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class BaseTestBug1254(BaseTestCase):
|
||||||
os.remove(file)
|
os.remove(file)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def cleanup(cls):
|
def finish(cls):
|
||||||
os.remove("bug.rc")
|
os.remove("bug.rc")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class BaseTestBug360(BaseTestCase):
|
||||||
os.remove(file)
|
os.remove(file)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def cleanup(cls):
|
def finish(cls):
|
||||||
os.remove("bug.rc")
|
os.remove("bug.rc")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,15 +43,11 @@ class BaseTestBug1300(BaseTestCase):
|
||||||
fh.write("data.location=.\n"
|
fh.write("data.location=.\n"
|
||||||
"confirmation=no\n")
|
"confirmation=no\n")
|
||||||
|
|
||||||
def tearDown(self):
|
@classmethod
|
||||||
"""Needed after each test or setUp will cause duplicated data at start
|
def finish(cls):
|
||||||
of the next test.
|
|
||||||
"""
|
|
||||||
for file in glob("*.data"):
|
for file in glob("*.data"):
|
||||||
os.remove(file)
|
os.remove(file)
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def cleanup(cls):
|
|
||||||
os.remove("bug.rc")
|
os.remove("bug.rc")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,6 @@ class BaseTest285(BaseTestCase):
|
||||||
"verbose=nothing\n"
|
"verbose=nothing\n"
|
||||||
"confirmation=no\n")
|
"confirmation=no\n")
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
"""Executed before each test in the class"""
|
|
||||||
|
|
||||||
# OVERDUE YESTERDAY DUE TODAY TOMORROW WEEK MONTH YEAR
|
# OVERDUE YESTERDAY DUE TODAY TOMORROW WEEK MONTH YEAR
|
||||||
# due:-1week Y - - - - ? ? ?
|
# due:-1week Y - - - - ? ? ?
|
||||||
# due:-1day Y Y - - - ? ? ?
|
# due:-1day Y Y - - - ? ? ?
|
||||||
|
@ -56,27 +53,21 @@ class BaseTest285(BaseTestCase):
|
||||||
# due:1month - - - - - - - ?
|
# due:1month - - - - - - - ?
|
||||||
# due:1year - - - - - - - -
|
# due:1year - - - - - - - -
|
||||||
|
|
||||||
self.callTaskSuccess(['rc:bug.rc', 'add', 'due_last_week', 'due:-1week'])
|
cls.callTaskSuccess(['rc:bug.rc', 'add', 'due_last_week', 'due:-1week'])
|
||||||
self.callTaskSuccess(['rc:bug.rc', 'add', 'due_yesterday', 'due:-1day'])
|
cls.callTaskSuccess(['rc:bug.rc', 'add', 'due_yesterday', 'due:-1day'])
|
||||||
self.callTaskSuccess(['rc:bug.rc', 'add', 'due_earlier_today', 'due:today'])
|
cls.callTaskSuccess(['rc:bug.rc', 'add', 'due_earlier_today', 'due:today'])
|
||||||
self.callTaskSuccess(['rc:bug.rc', 'add', 'due_later_today', 'due:tomorrow'])
|
cls.callTaskSuccess(['rc:bug.rc', 'add', 'due_later_today', 'due:tomorrow'])
|
||||||
self.callTaskSuccess(['rc:bug.rc', 'add', 'due_three_days', 'due:3days'])
|
cls.callTaskSuccess(['rc:bug.rc', 'add', 'due_three_days', 'due:3days'])
|
||||||
self.callTaskSuccess(['rc:bug.rc', 'add', 'due_next_month', 'due:1month'])
|
cls.callTaskSuccess(['rc:bug.rc', 'add', 'due_next_month', 'due:1month'])
|
||||||
self.callTaskSuccess(['rc:bug.rc', 'add', 'due_next_year', 'due:1year'])
|
cls.callTaskSuccess(['rc:bug.rc', 'add', 'due_next_year', 'due:1year'])
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
"""Needed after each test or setUp will cause duplicated data at start
|
|
||||||
of the next test.
|
|
||||||
"""
|
|
||||||
for file in glob("*.data"):
|
|
||||||
os.remove(file)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def finish(cls):
|
def finish(cls):
|
||||||
os.remove("bug.rc")
|
|
||||||
for file in glob("*.data"):
|
for file in glob("*.data"):
|
||||||
os.remove(file)
|
os.remove(file)
|
||||||
|
|
||||||
|
os.remove("bug.rc")
|
||||||
|
|
||||||
|
|
||||||
class Test285(BaseTest285):
|
class Test285(BaseTest285):
|
||||||
def test_overdue(self):
|
def test_overdue(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue