diff --git a/changedetectionio/flask_app.py b/changedetectionio/flask_app.py index 7a8c7b30b..164c0c8d1 100644 --- a/changedetectionio/flask_app.py +++ b/changedetectionio/flask_app.py @@ -4,10 +4,10 @@ import flask_login import locale import os import queue +import sys import threading import time import timeago -import asyncio from blinker import signal from changedetectionio.strtobool import strtobool @@ -601,8 +601,9 @@ def changedetection_app(config=None, datastore_o=None): ticker_thread = threading.Thread(target=ticker_thread_check_time_launch_checks).start() threading.Thread(target=notification_runner).start() + in_pytest = "pytest" in sys.modules or "PYTEST_CURRENT_TEST" in os.environ # Check for new release version, but not when running in test/build or pytest - if not os.getenv("GITHUB_REF", False) and not strtobool(os.getenv('DISABLE_VERSION_CHECK', 'no')): + if not os.getenv("GITHUB_REF", False) and not strtobool(os.getenv('DISABLE_VERSION_CHECK', 'no')) and not in_pytest: threading.Thread(target=check_for_new_version).start() # Return the Flask app - the Socket.IO will be attached to it but initialized separately diff --git a/changedetectionio/tests/test_api.py b/changedetectionio/tests/test_api.py index 7703f42ca..4aa7fec7e 100644 --- a/changedetectionio/tests/test_api.py +++ b/changedetectionio/tests/test_api.py @@ -108,7 +108,7 @@ def test_api_simple(client, live_server, measure_memory_usage): headers={'x-api-key': api_key} ) assert len(res.json) == 0 - + time.sleep(1) wait_for_all_checks(client) set_modified_response() @@ -119,6 +119,7 @@ def test_api_simple(client, live_server, measure_memory_usage): ) wait_for_all_checks(client) + time.sleep(1) # Did the recheck fire? res = client.get( url_for("createwatch"),