Commit graph

50 commits

Author SHA1 Message Date
Dustin J. Mitchell
fdb7e5e020
Test for unusual task data (#3770)
* Test for unusual task data

A task might have any combination of keys and values, but Taskwarrior
often assumes that only valid values can occur, and crashes otherwise.
This is highly inconvenient, as it's often impossible to do anything
with the invalid task -- Taskwarrior just fails without modifying it.

So, this is the beginning of some testing for such invalid tasks, with
the goal of making Taskwarrior due something reasonable. In general, an
invalid attribute value is treated as if it was not set. This is not
exhaustive, and there are likely still bugs of this sort, but as we find
them we can fix and add regression tests to this script.

This introduces a new test-only binary that creates a "bare" task using
TaskChampion, avoiding Taskwarrior's efforts to not create "unusual"
tasks.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-02-05 08:20:35 -05:00
Felix Schurk
93356b39c3 add initial bulk run from pre-commit over all files 2024-07-29 22:34:51 +02:00
Adrian Sadłocha
bb72ea6169
Remove encoding declaration in Python files (#3568)
As per
https://docs.python.org/3.11/reference/lexical_analysis.html#encoding-declarations,
the default encoding of Python files is UTF-8. In fact, it's been the
default encoding since Python 3.0 (released in 2008).
2024-07-26 23:36:23 -04:00
Felix Schurk
5ab51271b0
increase timout to 10s and run on ubuntu-latest (#3523)
As identified in #3512 it seams as the problem was the internal timeout.
Closes #3507.
2024-06-28 18:11:53 -04:00
Felix Schurk
e0e6ea7170
remove test certificates and link in python code (#3506)
With taskwarrior > 3.0 these are no longer required and thus can be
removed.
2024-06-22 19:52:43 -04:00
Dustin J. Mitchell
28a46880a2
Treat a nonzero exit status as a failure (#3430)
And fix the test cases that have been failing ,undetected
2024-05-03 13:58:09 +00:00
Felix Schurk
d093ce3d84
Fix test script paths (#3387)
* fix path to task executable in pyton tests

The current approach would copy the current files into the `build/test`
directory. Updating the paths according to the custom user setup.

By the copy I appended `.py` to have a clear visible distingtion which
ones are the python tests.

As soon as a source file in the normal directory is changed, it is
copied over and the corresponding file is updated.

From now on the python tests would need to get run in the according
build directory.

* reflect the current build instruction in PR template

* update paths and globing in run_all

* add line break for every cpp test

* remove .gitignore in test folder

As now all the auxillary files such as `all.log` as well as the
executables are present in the `build` directory there is no longer a
need to ignore them.

* update paths in python test scripts and enable deactivated

* remove .py extension when copy to build

Further remove glob pattern for `*.t.py` tests.

* remove accidentally added template.t from test files
2024-04-28 15:38:14 -04:00
Dustin J. Mitchell
31105c2ba3
Sync against taskchampion-sync-server (#3118)
This removes use of gnutls and the TLS implementation, which is no
longer needed (task synchronization is handled via Taskchampion, which
uses `reqwest`, which handles TLS via other Rust dependencies). This
incidentally removes the following config options:
 * `debug.tls`
 * `taskd.ca`
 * `taskd.certificate`
 * `taskd.ciphers`
 * `taskd.credentials`
 * `taskd.key`
 * `taskd.server`
 * `taskd.trust`
2023-07-08 10:27:33 -04:00
Tomas Babej
d81b999fa9 tests: Do not require line buffering
Test runner complains about it not being supported with binary files and
it does not look like it affects any tests in the first place anyway.
2020-11-21 12:27:05 -05:00
Tomas Babej
407d66d681 tests: Use updated Thread object API
Replace isAlive with is_alive as the former is no longer supported in
Python 3.9.
2020-11-21 12:27:05 -05:00
Martin Michlmayr
174507e7ad Fix typos 2020-11-17 10:41:13 -05:00
Tomas Babej
9b690fca57 tests: Improve bytes python3 compatibility 2019-01-01 20:11:13 -05:00
Tomas Babej
7c37940549 tests: Encode input data for the subprocess
Needed for Python2/3 compatibility.
2019-01-01 19:09:54 -05:00
Jakub Wilk
e36145b4fa Tests: Don't hardcode errno constants
The values of ENOENT and ESRCH are architecture-dependent, so don't
assume they're always 2 and 3.
2018-02-17 13:59:29 +01:00
Renato Alves
341b528980 Tests: More Python 3 compatibility changes 2015-07-24 15:29:41 +01:00
Renato Alves
188fd4ba61 Tests: Accessory functions to create temporary files
These use tempfile.NamedTemporaryFile but allow execution without
raising "Text file busy".
The file is removed at exit (of the process) so no cleanup is necessary.
2015-06-05 14:13:07 +01:00
Renato Alves
e60ea2e07a Revert "Tests: Use IP address instead of hostname with taskd"
Going back to using "localhost". Using the IP address causes GNUTLS
handshake errors in GnuTLS <= 3.2.18

This reverts commit 233d97fbff.
2015-04-26 18:13:20 +01:00
Renato Alves
931afb0674 Tests: Documentation on TASK/TASKD_USE_PATH 2015-04-26 17:46:44 +01:00
Renato Alves
233d97fbff Tests: Use IP address instead of hostname with taskd 2015-04-26 00:24:59 +01:00
Renato Alves
64be230639 Tests: Include taskd in USE_PATH warning 2015-04-25 23:59:49 +01:00
Renato Alves
d76d5c3587 Tests: Make sleeptime in wait_conditional an argument 2015-03-27 10:53:18 +00:00
Renato Alves
526665d4ec Tests: Configurable check for taskd readyness
* Also increase the frequency from 1/s to 2/s
2015-03-27 10:51:38 +00:00
Renato Alves
357850177d Tests: common/reusable variables live in basetest.utils 2015-03-27 10:14:44 +00:00
Renato Alves
180c382de2 Tests - Finer control on which binaries to look for on PATH
* It is now possible to control whether taskw and/or taskd are looked up
on the PATH by setting TASK_USE_PATH/TASKD_USE_PATH to "1"
2015-03-03 01:46:53 +00:00
Renato Alves
d211969236 Tests - clarify that USE_PATH alone is not enough. 2015-02-17 13:37:39 +00:00
Renato Alves
bd320b6729 Tests - Remove commented code 2015-02-17 12:24:13 +00:00
Renato Alves
3f004f547e Tests - Don't hang if spawning taskw fails 2015-02-17 12:24:13 +00:00
Renato Alves
9180aa6e33 Tests - minor formatting changes 2015-02-16 15:37:31 +00:00
Renato Alves
32d837fb25 Tests - Convert add.t to python
* Also added UUID_regex to basetest.utils, likely to be reused
2015-02-16 15:36:38 +00:00
Renato Alves
4b839f2c83 Tests - Significant speed improvement at cost of CPU cycles 2015-02-16 01:59:47 +00:00
Renato Alves
1e1bd32c42 Tests - Rework how taskw is launched from python
* Should avoid some odd race conditions
2015-02-16 01:59:32 +00:00
Renato Alves
d1698eab2d Fix usage of taskd.trust=strict on the test suite
* This reverts commit 67cb30fdce.
* Code also now tests if taskd is listening on IPv4 or IPv6 interfaces.
2015-01-20 11:56:53 +00:00
Renato Alves
d261a38d17 Unittest - Enhanced support for testing hooks (wip)
* It is now possible to test:
  * Hook Input/Output on STDIN/STDOUT channels
  * Exit code of hook script
  * Execution count (how many times the hook was executed)
  * Timestamp execution (when was the hook executed - milisec resolution)
2014-11-02 00:01:06 +00:00
Renato Alves
efdb31fb90 Unittest - default to not merging stdout/stderr during tests
* Tests will now check that stderr is used for errors
* Tests were adjusted to reflect the API change
2014-10-20 14:01:21 +01:00
Renato Alves
b4f33ec0c6 Unittest - Replace None by objects representing the state of stdout/err 2014-10-20 13:29:30 +01:00
Renato Alves
bb060d5ff8 Unittest - Allow specifying custom timeout for slow commands.
* Useful when testing with big tasks (1000+ annotations) or sync
operations that take longer than 1 second (default)
2014-10-16 20:52:17 +01:00
Renato Alves
cf5c7abd01 Unittest - Workaround race condition when killing slow processes
* In some cases the process finishes normally very close to the timeout
2014-10-16 16:47:10 +01:00
Renato Alves
53fd37cae2 Unittest - Also propagate the correct exit code 2014-10-10 16:42:41 +01:00
Renato Alves
40a95e1196 Unittest - Fix case where exit code was incorrectly registered 2014-10-10 16:19:39 +01:00
Renato Alves
d9d3b47c31 Unittest - default to ../src/ as location for task/taskd binaries 2014-07-31 17:03:49 +01:00
Renato Alves
974045da7a Unittest - Helper code to easily parse tx.data 2014-07-19 02:28:52 +01:00
Renato Alves
a88b3be093 Unittest - Memoize utils.which for faketime speedups 2014-07-18 17:23:19 +01:00
Renato Alves
d69533add1 Unittest - Add a memoize function for caching of function results 2014-07-18 17:22:17 +01:00
Renato Alves
00ee5b2289 Unittest - Skip tests that use faketime if not available 2014-07-18 17:20:27 +01:00
Renato Alves
2a198d59fe Unittest - Add mechanism to skip task and taskd tests
* When testing multiple clients vs server versions, repeating client
tests is unnecessary. By setting the env variables TASKW_SKIP and
TASKD_SKIP it will now be possible to skip all task (client only) and
taskd (client + server) tests, respectively.
2014-07-18 13:33:51 +01:00
Renato Alves
1f279ffde8 Unittest - Try to avoid racing conditions failures when capturing stdout/stderr
* The new unblocking strategy for subprocesses involves timeouts and
waiting periods. If the timeout is too short (or absent) tests may show
intermittent failure.
* Increasing the timeout may make tests a bit slower but more reliable.
2014-07-15 03:29:49 +01:00
Renato Alves
e3d0d2ff34 Unittest - Stream blocking tests can now be safely performed
* Processes that blocked waiting for stdin data will now be aborted
after a 1 second timeout.
* As a side-effect any process that takes longer than 1 second to
finish will also be aborted.
2014-07-15 02:43:57 +01:00
Renato Alves
b77dfc6312 Unittest - Add which() backported from py3.3 2014-07-15 00:49:50 +01:00
Renato Alves
715a414abd UnitTests
* Taskd and Taskw classes for testing are now available
 * Testing of server and client can now be performed.
 * The newer test wrappers will eventually replace the BaseTest class
2014-07-06 02:03:04 +01:00
Renato Alves
29d5de1154 Testing
Add a class to manage one or more taskd servers running on the same
machine.
2014-05-17 21:44:51 +01:00