Commit f2451c59 authored by Gordon Ball's avatar Gordon Ball

New upstream version 1.1.1+ds.1

parent 87662384
......@@ -58,3 +58,4 @@ suggestions:
Bodo Graumann
Lynoure
Tim Ruffing
Christian Decker
......@@ -6,7 +6,7 @@ set (HAVE_CMAKE true)
project (timew)
include (CXXSniffer)
set (PROJECT_VERSION "1.1.0")
set (PROJECT_VERSION "1.1.1")
message ("-- Looking for SHA1 references")
if (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
......
1.1.0 (2018-01-13) -
1.1.1 (2018-02-03) -
- TI-102 Exclusions stopped working
(thanks to Christian Decker)
------ current release ---------------------------
1.1.0 (2018-01-13) 836bc41014018ab333e6ea73412ee09d015beb4e
- TD-120 Missing cmakedefine for HAVE_GET_CURRENT_DIR_NAME
(thanks to Jörg Krause, Ben Boeckel).
......@@ -66,7 +73,7 @@
(thanks to Tim Ruffing)
- TI-90 Let 'continue' accept a date or a date range
- TI-91 Timewarrior does not compile on DragonFly
(thanks to Michael Neumann).
(thanks to Michael Neumann)
- Fixed Python 3 support of the holiday/refresh script
(thanks to Jelle van der Waa).
- Added missing man page link
......@@ -79,7 +86,7 @@
'soq' and 'soy'. Similarly the 'eocw' etc are modified. The 'c' is now
implicit.
------ current release ---------------------------
------ old release -------------------------------
1.0.0 (2016-08-17) 6428ce89fcf2a5665d9351c50c2a84c98543206c
......@@ -90,8 +97,6 @@
- Added 'totals.py' sample extension.
- Added extension list to the 'help' command.
------ old release ---------------------------
1.0.0.beta1 (2016-07-26) -
- TI-9 Task spanning over whole day should show up as taking 24:00 instead
......
.TH timew 1 2018-01-13 "${PACKAGE_STRING}" "User Manuals"
.TH timew 1 2018-02-03 "${PACKAGE_STRING}" "User Manuals"
.SH NAME
timew \- A command line time tracker.
......
......@@ -24,10 +24,8 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <commands.h>
#include <timew.h>
#include <Interval.h>
#include <iostream>
////////////////////////////////////////////////////////////////////////////////
......@@ -37,12 +35,10 @@ int CmdStart (
Database& database)
{
// Add a new open interval, which may have a defined start time.
auto filter = getFilter (cli);
auto holidays = subset (filter.range, getHolidays (rules));
auto exclusions = getAllExclusions (rules, filter.range);
auto filter = getFilter (cli);
auto latest = getLatestInterval (database);
// If the latest interval is open, close it.
auto latest = getLatestInterval (database);
if (latest.range.is_open ())
{
// If the new interval tags match those of the currently open interval, then
......@@ -64,13 +60,15 @@ int CmdStart (
// Update database.
database.deleteInterval (latest);
for (auto& interval : flatten (modified, exclusions))
validate (cli, rules, database, modified);
for (auto& interval : flatten (modified, getAllExclusions (rules, modified.range)))
{
database.addInterval (interval);
}
if (rules.getBoolean ("verbose"))
std::cout << intervalSummarize (database, rules, modified);
if (rules.getBoolean ("verbose"))
std::cout << intervalSummarize (database, rules, interval);
}
}
// Now add the new open interval.
......
......@@ -24,12 +24,9 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <format.h>
#include <commands.h>
#include <timew.h>
#include <Interval.h>
#include <Lexer.h>
#include <iostream>
template <class T> T setIntersect (
......@@ -69,12 +66,21 @@ int CmdStop (
modified.range.end = filter.range.start;
}
else
{
modified.range.end = Datetime ();
}
// Close the interval.
database.deleteInterval (latest);
validate (cli, rules, database, modified);
database.addInterval (modified);
for (auto& interval : flatten (modified, getAllExclusions (rules, modified.range)))
{
database.addInterval (interval);
if (rules.getBoolean ("verbose"))
std::cout << intervalSummarize (database, rules, interval);
}
// If tags are specified, but are not a full set of tags, remove them
// before closing the interval.
......
......@@ -24,7 +24,6 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <commands.h>
#include <timew.h>
#include <iostream>
......@@ -35,9 +34,10 @@ int CmdTrack (
Rules& rules,
Database& database)
{
auto filter = getFilter (cli);
// If this is not a proper closed interval, then the user is trying to make
// the 'track' command behave like 'start', so delegate to CmdStart.
auto filter = getFilter (cli);
if (! filter.range.is_started () ||
! filter.range.is_ended ())
return CmdStart (cli, rules, database);
......@@ -45,12 +45,13 @@ int CmdTrack (
// Validation must occur before flattening.
validate (cli, rules, database, filter);
auto exclusions = getAllExclusions (rules, filter.range);
for (auto& interval : flatten (filter, exclusions))
for (auto& interval : flatten (filter, getAllExclusions (rules, filter.range)))
{
database.addInterval (interval);
if (rules.getBoolean ("verbose"))
std::cout << intervalSummarize (database, rules, filter);
if (rules.getBoolean ("verbose"))
std::cout << intervalSummarize (database, rules, interval);
}
return 0;
}
......
......@@ -26,10 +26,12 @@
#
###############################################################################
import sys
import os
import sys
import unittest
from datetime import datetime
import datetime
# Ensure python finds the local simpletap module
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
......@@ -51,6 +53,7 @@ from basetest import Timew, TestCase
# self.assertNotRegexpMatches(text, pattern)
# self.tap("")
class TestExport(TestCase):
def setUp(self):
"""Executed before each test in the class"""
......@@ -72,6 +75,124 @@ class TestExport(TestCase):
self.assertTrue('tags' in j[0])
self.assertEqual(j[0]['tags'][0], 'foo')
def test_changing_exclusion_does_not_change_flattened_intervals(self):
"""Changing exclusions does not change flattened intervals"""
self.t.config("exclusions.monday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.tuesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.wednesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.thursday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.friday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.saturday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.sunday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t("track 20160101T102255 - 20160101T154422 foo")
self.t.config("exclusions.monday", "<9:11:50 12:44:22-13:23:32 >18:05:11")
self.t.config("exclusions.tuesday", "<9:11:50 12:44:22-13:23:32 >18:05:11")
self.t.config("exclusions.wednesday", "<9:11:50 12:44:22-13:23:32 >18:05:11")
self.t.config("exclusions.thursday", "<9:11:50 12:44:22-13:23:32 >18:05:11")
self.t.config("exclusions.friday", "<9:11:50 12:44:22-13:23:32 >18:05:11")
self.t.config("exclusions.saturday", "<9:11:50 12:44:22-13:23:32 >18:05:11")
self.t.config("exclusions.sunday", "<9:11:50 12:44:22-13:23:32 >18:05:11")
self.t("track 20160102T102255 - 20160102T154422 bar")
j = self.t.export()
self.assertEqual(len(j), 4)
self.assertTrue('start' in j[0])
self.assertIn('2255Z', j[0]['start'])
self.assertTrue('end' in j[0])
self.assertIn('2244Z', j[0]['end'])
self.assertTrue('tags' in j[0])
self.assertEqual(j[0]['tags'][0], 'foo')
self.assertTrue('start' in j[1])
self.assertIn('3223Z', j[1]['start'])
self.assertTrue('end' in j[1])
self.assertIn('4422Z', j[1]['end'])
self.assertTrue('tags' in j[1])
self.assertEqual(j[1]['tags'][0], 'foo')
self.assertTrue('start' in j[2])
self.assertIn('2255Z', j[2]['start'])
self.assertTrue('end' in j[2])
self.assertIn('4422Z', j[2]['end'])
self.assertTrue('tags' in j[2])
self.assertEqual(j[2]['tags'][0], 'bar')
self.assertTrue('start' in j[3])
self.assertIn('2332Z', j[3]['start'])
self.assertTrue('end' in j[3])
self.assertIn('4422Z', j[3]['end'])
self.assertTrue('tags' in j[3])
self.assertEqual(j[3]['tags'][0], 'bar')
def test_changing_exclusion_does_change_open_interval(self):
"""Changing exclusions does change open interval"""
now = datetime.datetime.now()
if now.time() < datetime.time(5):
self.skipTest("Test cannot not be run before 05:00:00")
return
three_hours_before = now - datetime.timedelta(hours=3)
four_hours_before = now - datetime.timedelta(hours=4)
five_hours_before = now - datetime.timedelta(hours=5)
exclusion = "{:%H}:12:21-{:%H}:34:43".format(four_hours_before, three_hours_before)
self.t.config("exclusions.friday", exclusion)
self.t.config("exclusions.thursday", exclusion)
self.t.config("exclusions.wednesday", exclusion)
self.t.config("exclusions.tuesday", exclusion)
self.t.config("exclusions.monday", exclusion)
self.t.config("exclusions.sunday", exclusion)
self.t.config("exclusions.saturday", exclusion)
self.t("start {}T{:%H}:00:00 foo".format(now.date(), five_hours_before))
j = self.t.export()
self.assertEqual(len(j), 2)
self.assertTrue('start' in j[0])
self.assertIn('0000Z', j[0]['start'])
self.assertTrue('end' in j[0])
self.assertIn('1221Z', j[0]['end'])
self.assertTrue('tags' in j[0])
self.assertEqual(j[0]['tags'][0], 'foo')
self.assertTrue('start' in j[1])
self.assertIn('3443Z', j[1]['start'])
self.assertFalse('end' in j[1])
exclusion = "{:%H}:34:43-{:%H}:12:21".format(four_hours_before, three_hours_before)
self.t.config("exclusions.friday", exclusion)
self.t.config("exclusions.thursday", exclusion)
self.t.config("exclusions.wednesday", exclusion)
self.t.config("exclusions.tuesday", exclusion)
self.t.config("exclusions.monday", exclusion)
self.t.config("exclusions.sunday", exclusion)
self.t.config("exclusions.saturday", exclusion)
j = self.t.export()
self.assertEqual(len(j), 2)
self.assertTrue('start' in j[0])
self.assertIn('0000Z', j[0]['start'])
self.assertTrue('end' in j[0])
self.assertIn('3443Z', j[0]['end'])
self.assertTrue('tags' in j[0])
self.assertEqual(j[0]['tags'][0], 'foo')
self.assertTrue('start' in j[1])
self.assertIn('1221Z', j[1]['start'])
self.assertFalse('end' in j[1])
if __name__ == "__main__":
from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner())
......
......@@ -26,10 +26,10 @@
#
###############################################################################
import sys
import os
import sys
import unittest
from datetime import datetime
# Ensure python finds the local simpletap module
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
......@@ -114,6 +114,131 @@ class TestStart(TestCase):
self.assertNotIn("Recorded bar foo", out)
def test_single_interval_enclosing_exclusion(self):
"""Add one interval that encloseѕ an exclusion, and is therefore flattened"""
self.t.config("exclusions.monday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.tuesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.wednesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.thursday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.friday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.saturday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.sunday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t("start 20160101T102255 foo")
self.t("start 20160101T154422 bar") # start bar, so foo gets closed and flattened
self.t("cancel") # cancel tracking of bar
j = self.t.export()
self.assertEqual(len(j), 2)
self.assertTrue('start' in j[0])
self.assertIn('2255Z', j[0]['start'])
self.assertTrue('end' in j[0])
self.assertIn('2244Z', j[0]['end'])
self.assertTrue('tags' in j[0])
self.assertEqual(j[0]['tags'][0], 'foo')
self.assertTrue('start' in j[1])
self.assertIn('3223Z', j[1]['start'])
self.assertTrue('end' in j[1])
self.assertIn('4422Z', j[1]['end'])
self.assertTrue('tags' in j[1])
self.assertEqual(j[1]['tags'][0], 'foo')
def test_single_interval_starting_within_an_exclusion_and_enclosing_an_exclusion(self):
"""Add one interval that starts within an exclusion and encloses an exclusion"""
self.t.config("exclusions.monday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.tuesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.wednesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.thursday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.friday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.saturday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.sunday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t("start 20160101T082255 foo")
self.t("start 20160101T144422 bar") # start bar, so foo gets closed and flattened
self.t("cancel") # cancel tracking of bar
j = self.t.export()
self.assertEqual(len(j), 2)
self.assertTrue('start' in j[0])
self.assertIn('2255Z', j[0]['start'])
self.assertTrue('end' in j[0])
self.assertIn('2244Z', j[0]['end'])
self.assertTrue('tags' in j[0])
self.assertEqual(j[0]['tags'][0], 'foo')
self.assertTrue('start' in j[1])
self.assertIn('3223Z', j[1]['start'])
self.assertTrue('end' in j[1])
self.assertIn('4422Z', j[1]['end'])
self.assertTrue('tags' in j[1])
self.assertEqual(j[1]['tags'][0], 'foo')
def test_single_interval_ending_within_an_exclusion_and_enclosing_an_exclusion(self):
"""Add one interval that ends within an exclusion and encloses an exclusion"""
self.t.config("exclusions.monday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.tuesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.wednesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.thursday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.friday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.saturday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.sunday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t("start 20160101T102255 foo")
self.t("start 20160101T194422 bar") # start bar, so foo gets closed and flattened
self.t("cancel") # cancel tracking of bar
j = self.t.export()
self.assertEqual(len(j), 2)
self.assertTrue('start' in j[0])
self.assertIn('2255Z', j[0]['start'])
self.assertTrue('end' in j[0])
self.assertIn('2244Z', j[0]['end'])
self.assertTrue('tags' in j[0])
self.assertEqual(j[0]['tags'][0], 'foo')
self.assertTrue('start' in j[1])
self.assertIn('3223Z', j[1]['start'])
self.assertTrue('end' in j[1])
self.assertIn('4422Z', j[1]['end'])
self.assertTrue('tags' in j[1])
self.assertEqual(j[1]['tags'][0], 'foo')
def test_single_interval_and_enclosing_an_exclusion_with_day_change(self):
"""Add one interval that encloses an exclusion with day change"""
self.t.config("exclusions.monday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.tuesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.wednesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.thursday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.friday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.saturday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.sunday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t("start 20160101T172255 foo")
self.t("start 20160102T104422 bar") # start bar, so foo gets closed and flattened
self.t("cancel") # cancel tracking of bar
j = self.t.export()
self.assertEqual(len(j), 2)
self.assertTrue('start' in j[0])
self.assertIn('2255Z', j[0]['start'])
self.assertTrue('end' in j[0])
self.assertIn('0511Z', j[0]['end'])
self.assertTrue('tags' in j[0])
self.assertEqual(j[0]['tags'][0], 'foo')
self.assertTrue('start' in j[1])
self.assertIn('1150Z', j[1]['start'])
self.assertTrue('end' in j[1])
self.assertIn('4422Z', j[1]['end'])
self.assertTrue('tags' in j[1])
self.assertEqual(j[1]['tags'][0], 'foo')
if __name__ == "__main__":
from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner())
......
......@@ -26,10 +26,10 @@
#
###############################################################################
import sys
import os
import sys
import unittest
from datetime import datetime
# Ensure python finds the local simpletap module
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
......@@ -51,6 +51,7 @@ from basetest import Timew, TestCase
# self.assertNotRegexpMatches(text, pattern)
# self.tap("")
class TestStop(TestCase):
def setUp(self):
"""Executed before each test in the class"""
......@@ -108,6 +109,123 @@ class TestStop(TestCase):
code, out, err = self.t.runError("stop four")
self.assertIn("The current interval does not have the 'four' tag.", err)
def test_single_interval_enclosing_exclusion(self):
"""Add one interval that encloseѕ an exclusion, and is therefore flattened"""
self.t.config("exclusions.monday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.tuesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.wednesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.thursday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.friday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.saturday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.sunday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t("start 20160101T100000 foo")
self.t("stop 20160101T150000")
j = self.t.export()
self.assertEqual(len(j), 2)
self.assertTrue('start' in j[0])
self.assertTrue('end' in j[0])
self.assertTrue('tags' in j[0])
self.assertEqual(j[0]['tags'][0], 'foo')
self.assertTrue('start' in j[1])
self.assertTrue('end' in j[1])
self.assertTrue('tags' in j[1])
self.assertEqual(j[1]['tags'][0], 'foo')
def test_single_interval_starting_within_an_exclusion_and_enclosing_an_exclusion(self):
"""Add one interval that starts within an exclusion and encloses an exclusion"""
self.t.config("exclusions.monday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.tuesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.wednesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.thursday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.friday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.saturday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.sunday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t("start 20160101T082255 foo")
self.t("stop 20160101T144422") # stop, so foo gets closed and flattened
j = self.t.export()
self.assertEqual(len(j), 2)
self.assertTrue('start' in j[0])
self.assertIn('2255Z', j[0]['start'])
self.assertTrue('end' in j[0])
self.assertIn('2244Z', j[0]['end'])
self.assertTrue('tags' in j[0])
self.assertEqual(j[0]['tags'][0], 'foo')
self.assertTrue('start' in j[1])
self.assertIn('3223Z', j[1]['start'])
self.assertTrue('end' in j[1])
self.assertIn('4422Z', j[1]['end'])
self.assertTrue('tags' in j[1])
self.assertEqual(j[1]['tags'][0], 'foo')
def test_single_interval_ending_within_an_exclusion_and_enclosing_an_exclusion(self):
"""Add one interval that ends within an exclusion and encloses an exclusion"""
self.t.config("exclusions.monday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.tuesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.wednesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.thursday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.friday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.saturday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.sunday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t("start 20160101T102255 foo")
self.t("stop 20160101T194422") # stop, so foo gets closed and flattened
j = self.t.export()
self.assertEqual(len(j), 2)
self.assertTrue('start' in j[0])
self.assertIn('2255Z', j[0]['start'])
self.assertTrue('end' in j[0])
self.assertIn('2244Z', j[0]['end'])
self.assertTrue('tags' in j[0])
self.assertEqual(j[0]['tags'][0], 'foo')
self.assertTrue('start' in j[1])
self.assertIn('3223Z', j[1]['start'])
self.assertTrue('end' in j[1])
self.assertIn('4422Z', j[1]['end'])
self.assertTrue('tags' in j[1])
self.assertEqual(j[1]['tags'][0], 'foo')
def test_single_interval_and_enclosing_an_exclusion_with_day_change(self):
"""Add one interval that encloses an exclusion with day change"""
self.t.config("exclusions.monday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.tuesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.wednesday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.thursday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.friday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.saturday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t.config("exclusions.sunday", "<9:11:50 12:22:44-13:32:23 >18:05:11")
self.t("start 20160101T172255 foo")
self.t("stop 20160102T104422") # stop, so foo gets closed and flattened
j = self.t.export()
self.assertEqual(len(j), 2)
self.assertTrue('start' in j[0])
self.assertIn('2255Z', j[0]['start'])
self.assertTrue('end' in j[0])
self.assertIn('0511Z', j[0]['end'])
self.assertTrue('tags' in j[0])
self.assertEqual(j[0]['tags'][0], 'foo')
self.assertTrue('start' in j[1])
self.assertIn('1150Z', j[1]['start'])
self.assertTrue('end' in j[1])
self.assertIn('4422Z', j[1]['end'])
self.assertTrue('tags' in j[1])
self.assertEqual(j[1]['tags'][0], 'foo')
if __name__ == "__main__":
from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner())
......
......@@ -26,10 +26,10 @@
#
###############################################################################
import sys
import os
import sys
import unittest
from datetime import datetime
# Ensure python finds the local simpletap module
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
......@@ -51,6 +51,7 @@ from basetest import Timew, TestCase
# self.assertNotRegexpMatches(text, pattern)
# self.tap("")
class TestTrack(TestCase):
def setUp(self):
"""Executed before each test in the class"""
......@@ -124,6 +125,7 @@ class TestTrack(TestCase):
j = self.t.export()
self.assertTrue(len(j) > 0)
if __name__ == "__main__":
from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment