Commit graph

47 commits

Author SHA1 Message Date
1e45aa5de9
A more robust logic to wait for the app to start in the tests.
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-04 23:24:25 +01:00
1819ee75ef
s/Application.stop_app/Application.stop/g 2023-08-13 22:23:15 +02:00
91cd08cdff
Adapted tests to use a locally started Redis instance. 2023-07-24 10:37:07 +02:00
37dcaba7a1
Refactored structure of main application and startup scripts.
The main application class has been moved from __init__ to the app
module.

__init__ will contain instead the relevant global variables and the
modules and objects exposed to external integrations - such as
`get_plugin` and `get_backend`, or the `main` itself.

This will make future integrations much easier - the global __init__
doesn't contain any business logic now, it can import anything without
fearing circular dependencies, and it can limit its exposed objects to
those that we want to expose to 3rd-party integrations and scripts.

It will also make it easier to extend the main entry point with
additional logic - such as a supervisor or an embedded Redis server.
2023-07-23 23:12:36 +02:00
666ea9ea6b
Added use_werkzeug_server option to backend.http.
There are situations where you may not want to run the HTTP server in a
full blown WSGI-over-Tornado container - unit/integration tests and
embedded single-core devices are among those cases.

In those scenarios, we should allow the user to be able to run the
backend using the built-in Werkzeug server provided by Flask.
2023-05-20 15:26:58 +02:00
c690230930
An AssistantEvent should not fail initialization if the assistant integration isn't found. 2023-05-04 00:28:50 +02:00
04b1dad6d8
Removed test_cron_execution_upon_system_clock_change.
The test is too brittle as it depends on small mocked clock skews and it
can easily fail.
2023-05-04 00:11:11 +02:00
162904f281
[#253] Added support for relational filters on event hooks. 2023-04-27 22:07:02 +02:00
245472a4c5
Better event hooks filters.
- Support for nested attributes on event hook conditions. Things like
  these are now possible:

```
from platypush.event.hook import hook
from platypush.message.event.entities import EntityUpdateEvent

@hook(EntityUpdateEvent, entity={"external_id": "system:cpu"})
def on_cpu_update_event(event: EntityUpdateEvent, **_):
    print(event.args["entity"]["percent"])
```

- The scoring/regex extraction/partial string match logic in
  `_matches_argument` is actually only needed for
  `SpeechRecognizedEvent`. Other events don't need these features, and
  event hooks may be actually triggered unexpectedly in case of partial
  matches. Therefore, the "complex" `_matches_argument` has been moved
  as an override only for `SpeechRecognizedEvent`, and all the other
  events will perform simple key-value matching.
2023-04-26 01:45:58 +02:00
4f15758de9
black fixes 2023-03-31 14:31:38 +02:00
6ec8a991df
Fixed tests 2022-10-08 15:18:26 +02:00
41d0725ebf
Fix for #217
The cron scheduler has been made more robust against changes in the
system clock (caused by e.g. DST changes, NTP syncs or manual setting).

A more granular management for cronjob events has been introduced, now
supporting a `TIME_SYNC` event besides the usual `STOP`. When the cron
scheduler detects a system clock drift (i.e. the timestamp offset before
and after a blocking wait is >1 sec) then all the cronjobs are notified
and forced to refresh their state.
2022-04-28 00:57:49 +02:00
eae4b4f62a The tmp_file fixture destructor should clean up any temporary files (in case multiple tests import it) 2021-03-09 00:22:18 +01:00
296458ece3 Cron expressions should follow the machine local time, not UTC [closes #173] 2021-03-09 00:18:33 +01:00
c659ec507f Added tests/__main__.py entry point to run all the tests 2021-03-06 20:13:38 +01:00
34a108bbcb Clear log objects on teardown to prevent pytest logging errors 2021-03-06 20:02:25 +01:00
090e7d6de8 Support for specifying the application Redis queue from the command line or service constructor 2021-03-06 19:22:13 +01:00
6f85318868 Use another Redis queue for the test app to prevent clashes with another Platypush service running on the same machine 2021-03-06 17:17:55 +01:00
8f256e4077 Check for file creation and content multiple times with timeout 2021-03-06 17:09:40 +01:00
4ed80a0945 More tests improvements 2021-03-06 17:03:50 +01:00
ca90060ba1 Tests improvements 2021-03-06 16:25:37 +01:00
49ad3261f1 Refactored tests to use pytest with fixtures instead of unittest.TestCase 2021-03-06 16:21:28 +01:00
66445cb4e4 - Do not parse Zeroconf info at all if not available
- Temporarily skip test_procedure until I find a proper way to clean up the status from the previous run and start a fresh platform
2021-02-27 21:11:37 +01:00
0d806eeb6e - Removed setUp method from test_event_parse - let the parent setUp run and properly start the daemon
- More resilient logic in case some entries in the Zeroconf registry are still loading and the info object is still None
2021-02-27 20:51:48 +01:00
3932fb56c4 test_event_parse must include a config_file, even if it doesn't use it, otherwise the service will fail to start 2021-02-27 17:01:47 +01:00
b4f9472fc5 - Proper expansion of the context variables on functional procedure call
- Expanded and refactored tests framework

- Added test_procedure
2021-02-27 15:01:25 +01:00
531be19a66 .context needs to be imported in test_event_parse to make sure that the configuration is properly initialized 2021-02-24 00:35:41 +01:00
571a8ca9d1 Improvements on HTTP integration test. Plus, removed ApplicationStoppedEvent - it's unreliable and it could be delivered when the bus has already been stopped 2021-02-24 00:23:32 +01:00
Fabio Manganiello
e5c8adfc1b Fixed and expanded integration tests to deal with HTTP user authentication 2020-12-16 02:10:37 +01:00
Fabio Manganiello
f5ef9957de Increased daemon warm-up waiting time and timeout in tests 2019-07-15 16:28:44 +02:00
Fabio Manganiello
570ef6f109 Replaced EventAction with Procedure to allow more flexibility in event hooks and cronjobs 2018-09-27 01:52:35 +02:00
Fabio Manganiello
d215410a6a More consistent flow for messages received by a backend 2018-09-24 23:13:44 +02:00
Fabio Manganiello
44962dd919 Removed timeout from get_plugin lock; Added Redis server to tests configuration 2018-09-20 10:59:18 +00:00
Fabio Manganiello
4ebdda80f9 More robust support for Redis configuration in web socket server 2018-07-08 12:24:33 +02:00
Fabio Manganiello
b3d82bf43e Added Redis backend configuration to the test 2018-07-08 12:20:39 +02:00
Fabio Manganiello
75fac37984 Fixed tests 2018-01-29 16:34:00 +01:00
Fabio Manganiello
252f503e4d Better management of the context and support for proper expression expansion from the context in the action execution through eval 2018-01-07 23:31:19 +01:00
Fabio Manganiello
301c356c33 Replaced the local fifo test with a test for the HTTP backend 2018-01-04 18:29:03 +01:00
Fabio Manganiello
6b58c96ebe Added __init__ in tests 2018-01-04 10:42:32 +01:00
Fabio Manganiello
4c62133378 Updated README 2018-01-03 02:23:25 +01:00
Fabio Manganiello
691a9c8593 Added test for the event/condition matching and parsing logic 2018-01-03 00:16:01 +01:00
Fabio Manganiello
4a6accf483 s/push/send_request/g 2018-01-02 19:33:33 +01:00
Fabio Manganiello
6e019865bc Placed a sleep to let all the messages be received before stopping everything (TODO: make sure that all the threads are synchronized on receive_msg and stop 2017-12-25 17:23:12 +01:00
Fabio Manganiello
97adb1a191 * Better documentation for the local backend
* Remove the fifos at the beginning of the test
2017-12-22 02:52:56 +01:00
Fabio Manganiello
bdf964531f - Documented the test
- Removed Python 3.4 support in Travis
2017-12-22 02:40:06 +01:00
Fabio Manganiello
a26466a4bf Added config.yaml for tests 2017-12-22 02:20:28 +01:00
Fabio Manganiello
3dfcf0ec97 Added tests 2017-12-22 02:11:56 +01:00