Commit graph

584 commits

Author SHA1 Message Date
Thomas Lauf
c71eeb6dfd Add DOM-query for ids
- Closes #126

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-05-10 21:44:30 +02:00
Thomas Lauf
a508dd21ea Get and use filter from CLI when processing DOM references
- Closes #188

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-05-10 21:44:30 +02:00
Thomas Lauf
6e5236d472 Add DOM query dom.tracked.tags
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-05-10 21:44:30 +02:00
Thomas Lauf
5c234c95f9 Move test setup to the test methods
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-05-10 21:44:30 +02:00
Thomas Lauf
ad58309159 Update Copyright
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-04-19 12:41:23 +02:00
Thomas Lauf
41c50e009c Add test for export with tag filter
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-03-06 16:13:00 +01:00
Shaun Ruffell
42872f5168 test: Add test for filtering non-contiguous intervals
Related to #293

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2020-03-06 16:10:19 +01:00
Thomas Lauf
bf87509329 Handle case of empty interval, fix tests
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-03-03 22:24:45 +01:00
Thomas Lauf
368d033ce5 Rename atomic to AtomicFileTest
- Avoid possible clash with lib atomic on macOS, e.g. in /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:668

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-03-02 21:42:53 +01:00
Thomas Lauf
551964eb15 Fix check for libfiu usage
- on macOS, use "otool -L" instead of "ldd"

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-03-01 21:08:32 +01:00
Shaun Ruffell
b5df2a2aa5 CmdHelp: Return error if man command fails
I feel this is expected behavior, but also eliminates the following compile time
warning on one of my systems:

  warning: ignoring return value of ‘int system(const char*)’, declared with
    attribute warn_unused_result [-Wunused-result]

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2020-03-01 21:02:43 +01:00
Thomas Lauf
9ae84426d9 Upgrade pip
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-03-01 20:33:41 +01:00
Thomas Lauf
fa4371d30c Return exit code of ./problems, not the last command, on macOS
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-03-01 20:33:40 +01:00
Thomas Lauf
6b75a5f92d Set bufsize to '-1' so we use io.DEFAULT_BUFFER_SIZE
- Removes RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-02-23 19:26:29 +01:00
Thomas Lauf
72f13b859f Remove obsolete code
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-02-23 19:03:54 +01:00
Thomas Lauf
cb7240fe1a Linebreak after <"""> in multiline doc-comments
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-02-23 19:03:54 +01:00
Thomas Lauf
457e73f772 Remove unnecessary input
- ":yes" hint already takes care of that

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-02-23 19:03:54 +01:00
Thomas Lauf
bb73c293ef Remove line breaks
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2020-02-23 19:03:54 +01:00
Shaun Ruffell
dcfe0d1c3d test/docker: containers should return non-zero values on failures 2020-02-23 19:03:40 +01:00
Shaun Ruffell
926ecd7333 test: Add write-failure.t
This test uses libfiu to create random failures in fputs and the write system
calls to verify out-of-space errors on the filesystem do not corrupt the
database.

Related to #155
2020-02-23 19:03:40 +01:00
Shaun Ruffell
8e99c07d85 Introduce AtomicFiles
Introduce AtomicFile and a test of this module to the code.

AtomicFile is like File, except all writes go to temporary files until
the class method finalize_all () is called and the temporary files are
copied over the real files. If any writes fail, like when there is no
more space on the filesystem, none of the files in the database will be
modified.

Since we need version 1.00 of libfiu, I have only added it to the debian
testing container, which includes libfiu-1.00 in the default repository.

Related to #155
2020-02-23 19:03:40 +01:00
Shaun Ruffell
85c5655f79 Replace 'ѕ' with 's' in test docstrings
Since the recent switch to python3, I've been noticing that some of the tests
have been aborting with the following error when I use LANG=en_US instead of
LANG=en_US.UTF-8:

UnicodeEncodeError: 'latin-1' codec can't encode character '\u0455' in position 57: ordinal not in range(256)

Arguably, I should run with a unicode locale while running the test, but it
*looks* to me like the original ѕ was not intended.
2020-01-26 22:38:52 +01:00
Shaun Ruffell
6852fd2924 test/problems: Report when tests do not run properly
When some of the individual tests fail to run, the `make test` target would
still pass since test/problems would not return an error which could hide the
fact that there are problems in the test.

With this change, if you do not have the python dateutil package, you will now
get output like:

  'test_totals.t' failed to run any tests.
  Passed:                           975
  Failed:                             1
  Unexpected successes:               0
  Skipped:                            0
  Expected failures:                  0
  Runtime:                         4.83 seconds

Or, if you do not have UTF-8 encoding set in your language you will get
something like:

  'track.t' failed to run all tests.
  'stop.t' failed to run all tests.
  'start.t' failed to run all tests.
  'test_totals.t' failed to run all tests.
  Passed:                           941
  Failed:                            50
  Unexpected successes:               0
  Skipped:                            0
  Expected failures:                  0
  Runtime:                         4.55 seconds
2020-01-26 22:38:52 +01:00
Shaun Ruffell
d62fc02649 test/problems: Change to allow match to be saved after each condition
This isn't a functional change, but will allow the capture groups to be
inspected for each of the regular expressions in a future commit.
2020-01-26 22:38:52 +01:00
Shaun Ruffell
f45734efe0 test:modify.t: Split tests to for synthetic / non-synthetic intervals
Split the single test for synthetic interval into two separate tests.
2020-01-26 19:49:23 +01:00
Shaun Ruffell
845ab2f805 test: Check move / annotate commands with both synthetic and non-synthetic intervals in database
These tests are designed to check that `getIntervalsById()` will not
count the open interval at the end of the database twice.

See https://github.com/GothenburgBitFactory/timewarrior/pull/269/files#r368238522
2020-01-26 19:49:23 +01:00
Shaun Ruffell
7b438830e2 test: Revert recent annotate.t and move.t changes
In commits 18559df275 and eaed297964 I had updated existing
tests when I should have created new tests to check mixed synethic /
non-synethic intervals.

This change reverts those changes and a follow-on commit will add the
new tests.

See https://github.com/GothenburgBitFactory/timewarrior/pull/269/files#r368238522
2020-01-26 19:49:23 +01:00
Shaun Ruffell
d9480b591a CmdModify: Allow modification of synthetic intervals
This fixes an issue in the modify command since it was first added. This will
allow modify to work in the presence of synthetic intervals.
2020-01-17 17:48:57 +01:00
Shaun Ruffell
18559df275 test/move.t: Make sure move handles mix of synthetic and non-synthetic intervals
This test updates one of the existing tests to make sure that an non-synthetic
interval in addition with the synthetic intervals can be moved properly.
2020-01-17 17:48:57 +01:00
Shaun Ruffell
eaed297964 test/annotate.t: Annotate a mix of synthetic / non-synthetic intervals 2020-01-17 17:48:57 +01:00
Shaun Ruffell
ff56bc4759 test/simpletap: Look for functions that start with "test_" on exceptions
Since the switch to python3, there is another method that starts with "test"
higher up in the stack which produces unhelpful file / line information on a
failed test like:

  ERROR: CommandError on file /usr/lib/python3.6/unittest/case.py line 59 in testPartExecutor: 'yield':

This change restores the previous behavior from before the switch to python 3.
2020-01-17 17:48:57 +01:00
Shaun Ruffell
0e354da1c7 test: Use faketime instead of date -v for relative dates
Ubuntu 18.04.3 does not have the -v option to the date utility.
2020-01-17 17:48:57 +01:00
Thomas Lauf
5e385b84a1 Switch to python 3
- #259

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-28 19:01:26 +01:00
Thomas Lauf
ddf713a722 Switch to python 3
- #259

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-27 19:08:57 +01:00
Thomas Lauf
13a8edc7ef Resharpen test stop with id should suggest modify command
- Amends #270

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-27 16:10:28 +01:00
Shaun Ruffell
145af6603c Stop with id should suggest modify command
Recently I was trying to stop an interval that I had left open over the
weekend, but I had already started a new interval at the beginning of the
week. The error I was received was "The end of a date range must be after the
start." which was confusing to me.

After a few moments I realized I should have been using the modify command.
Now the stop command will suggest modify if someone attempts to use stop for
this purpose.
2019-12-27 15:47:39 +01:00
Thomas Lauf
80fe5e4221 Use pyenv to run tests with python3
- #259

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-22 13:09:19 +01:00
Thomas Lauf
eccf82ff56 Print version information at end
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-21 22:55:02 +01:00
Thomas Lauf
6ecdbc5cf7 Remove unneeded packages
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-21 22:53:59 +01:00
Thomas Lauf
c6fb6c4e3a Fix installation of python3-dateutil
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-21 22:53:10 +01:00
Thomas Lauf
6637452a1f Cleanup Dockerfiles
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-21 22:32:56 +01:00
Thomas Lauf
5c1e037abc Persist activation of scl package
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-21 22:32:55 +01:00
Thomas Lauf
8189652bbc Print version information at end
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-21 22:32:46 +01:00
Thomas Lauf
800062ace2 Consolidate package list
- Remove unnecessary packages
- Sort packages alphabetically

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-21 22:32:36 +01:00
Thomas Lauf
660816ae5f Put packages on separate lines for better readability
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-21 22:32:25 +01:00
Thomas Lauf
28a3db5579 Switch to python 3
- #259

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-21 22:31:05 +01:00
Thomas Lauf
38ddb4ee5b Remove line break
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-11 10:20:33 +01:00
Thomas Lauf
09a77eddb3 Mark byte literals
- #259

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-11 10:20:33 +01:00
Thomas Lauf
c27344525b Remove compat.py
- There is only one string type in python3
- #259

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-11 10:20:33 +01:00
Thomas Lauf
c7e044373f Replace assertItemsEqual with assertSequenceEqual
- Add sorting for both lists
- #259

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-11 10:20:33 +01:00