From 02160fcbb558de2435088c7e3377d701c6a49b90 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 7 Jun 2024 10:52:33 +0200 Subject: [PATCH] tweaks --- changedetectionio/model/Watch.py | 2 ++ .../tests/test_automatic_follow_ldjson_price.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changedetectionio/model/Watch.py b/changedetectionio/model/Watch.py index 83bfb2e3..7ff8f7f0 100644 --- a/changedetectionio/model/Watch.py +++ b/changedetectionio/model/Watch.py @@ -217,6 +217,8 @@ class model(dict): fname = os.path.join(self.watch_data_dir, "history.txt") if os.path.isfile(fname): logger.debug(f"Reading watch history index for {self.get('uuid')}") + + with open(fname, "r") as f: for i in f.readlines(): if ',' in i: diff --git a/changedetectionio/tests/test_automatic_follow_ldjson_price.py b/changedetectionio/tests/test_automatic_follow_ldjson_price.py index 7da76962..7f1b22ce 100644 --- a/changedetectionio/tests/test_automatic_follow_ldjson_price.py +++ b/changedetectionio/tests/test_automatic_follow_ldjson_price.py @@ -81,7 +81,7 @@ def test_setup(client, live_server): # actually only really used by the distll.io importer, but could be handy too def test_check_ldjson_price_autodetect(client, live_server): - + #live_server_setup(live_server) set_response_with_ldjson() # Add our URL to the import page @@ -113,6 +113,9 @@ def test_check_ldjson_price_autodetect(client, live_server): # and last snapshop (via API) should be just the price api_key = extract_api_key_from_UI(client) + # Time for writes to happen to history text + time.sleep(0.5) + res = client.get( url_for("watchsinglehistory", uuid=uuid, timestamp='latest'), headers={'x-api-key': api_key},