From 0bec23bd72c75f94ccfae81e04db2faa5fb87bb5 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Thu, 9 Oct 2025 18:38:13 +0200 Subject: [PATCH] Add memor usage --- changedetectionio/tests/test_access_control.py | 2 +- .../tests/test_api_notifications.py | 2 +- changedetectionio/tests/test_api_search.py | 2 +- changedetectionio/tests/test_conditions.py | 6 +++--- .../tests/test_history_consistency.py | 2 +- changedetectionio/tests/test_ignore_text.py | 4 ++-- changedetectionio/tests/test_request.py | 2 +- .../tests/test_restock_itemprop.py | 18 +++++++++--------- changedetectionio/tests/test_rss.py | 2 +- changedetectionio/tests/test_scheduler.py | 2 +- changedetectionio/tests/test_ui.py | 10 +++++----- changedetectionio/tests/test_xpath_selector.py | 2 +- .../tests/visualselector/test_fetch_data.py | 4 ++-- 13 files changed, 29 insertions(+), 29 deletions(-) diff --git a/changedetectionio/tests/test_access_control.py b/changedetectionio/tests/test_access_control.py index a72e64a9..a3c62309 100644 --- a/changedetectionio/tests/test_access_control.py +++ b/changedetectionio/tests/test_access_control.py @@ -2,7 +2,7 @@ from .util import live_server_setup, wait_for_all_checks from flask import url_for import time -def test_check_access_control(app, client, live_server): +def test_check_access_control(app, client, live_server, measure_memory_usage): # Still doesnt work, but this is closer. # live_server_setup(live_server) # Setup on conftest per function diff --git a/changedetectionio/tests/test_api_notifications.py b/changedetectionio/tests/test_api_notifications.py index d8bad0aa..d5b97952 100644 --- a/changedetectionio/tests/test_api_notifications.py +++ b/changedetectionio/tests/test_api_notifications.py @@ -4,7 +4,7 @@ from flask import url_for from .util import live_server_setup import json -def test_api_notifications_crud(client, live_server): +def test_api_notifications_crud(client, live_server, measure_memory_usage): # live_server_setup(live_server) # Setup on conftest per function api_key = live_server.app.config['DATASTORE'].data['settings']['application'].get('api_access_token') diff --git a/changedetectionio/tests/test_api_search.py b/changedetectionio/tests/test_api_search.py index 7f7dd6a3..1863e3bf 100644 --- a/changedetectionio/tests/test_api_search.py +++ b/changedetectionio/tests/test_api_search.py @@ -6,7 +6,7 @@ import time from .util import live_server_setup, wait_for_all_checks -def test_api_search(client, live_server): +def test_api_search(client, live_server, measure_memory_usage): # live_server_setup(live_server) # Setup on conftest per function api_key = live_server.app.config['DATASTORE'].data['settings']['application'].get('api_access_token') diff --git a/changedetectionio/tests/test_conditions.py b/changedetectionio/tests/test_conditions.py index 2ca2f72b..ac3deb7f 100644 --- a/changedetectionio/tests/test_conditions.py +++ b/changedetectionio/tests/test_conditions.py @@ -47,11 +47,11 @@ def set_number_out_of_range_response(number="150"): f.write(test_return_data) -# def test_setup(client, live_server): +# def test_setup(client, live_server, measure_memory_usage): """Test that both text and number conditions work together with AND logic.""" # live_server_setup(live_server) # Setup on conftest per function -def test_conditions_with_text_and_number(client, live_server): +def test_conditions_with_text_and_number(client, live_server, measure_memory_usage): """Test that both text and number conditions work together with AND logic.""" set_original_response("50") @@ -142,7 +142,7 @@ def test_conditions_with_text_and_number(client, live_server): delete_all_watches(client) # The 'validate' button next to each rule row -def test_condition_validate_rule_row(client, live_server): +def test_condition_validate_rule_row(client, live_server, measure_memory_usage): set_original_response("50") diff --git a/changedetectionio/tests/test_history_consistency.py b/changedetectionio/tests/test_history_consistency.py index 69c55305..280ad131 100644 --- a/changedetectionio/tests/test_history_consistency.py +++ b/changedetectionio/tests/test_history_consistency.py @@ -80,7 +80,7 @@ def test_consistent_history(client, live_server, measure_memory_usage): assert '"default"' not in f.read(), "'default' probably shouldnt be here, it came from when the 'default' Watch vars were accidently being saved" -def test_check_text_history_view(client, live_server): +def test_check_text_history_view(client, live_server, measure_memory_usage): with open("test-datastore/endpoint-content.txt", "w") as f: f.write("test-one") diff --git a/changedetectionio/tests/test_ignore_text.py b/changedetectionio/tests/test_ignore_text.py index d42a934a..e575f866 100644 --- a/changedetectionio/tests/test_ignore_text.py +++ b/changedetectionio/tests/test_ignore_text.py @@ -244,10 +244,10 @@ def _run_test_global_ignore(client, as_source=False, extra_ignore=""): delete_all_watches(client) -def test_check_global_ignore_text_functionality(client, live_server): +def test_check_global_ignore_text_functionality(client, live_server, measure_memory_usage): _run_test_global_ignore(client, as_source=False) -def test_check_global_ignore_text_functionality_as_source(client, live_server): +def test_check_global_ignore_text_functionality_as_source(client, live_server, measure_memory_usage): _run_test_global_ignore(client, as_source=True, extra_ignore='/\?v=\d/') diff --git a/changedetectionio/tests/test_request.py b/changedetectionio/tests/test_request.py index 3110eef6..34a9c8df 100644 --- a/changedetectionio/tests/test_request.py +++ b/changedetectionio/tests/test_request.py @@ -395,7 +395,7 @@ def test_headers_textfile_in_request(client, live_server, measure_memory_usage): # unlink headers.txt on start/stop delete_all_watches(client) -def test_headers_validation(client, live_server): +def test_headers_validation(client, live_server, measure_memory_usage): test_url = url_for('test_headers', _external=True) diff --git a/changedetectionio/tests/test_restock_itemprop.py b/changedetectionio/tests/test_restock_itemprop.py index 59057220..62588188 100644 --- a/changedetectionio/tests/test_restock_itemprop.py +++ b/changedetectionio/tests/test_restock_itemprop.py @@ -44,11 +44,11 @@ def set_original_response(props_markup='', price="121.95"): -# def test_setup(client, live_server): +# def test_setup(client, live_server, measure_memory_usage): # live_server_setup(live_server) # Setup on conftest per function -def test_restock_itemprop_basic(client, live_server): +def test_restock_itemprop_basic(client, live_server, measure_memory_usage): @@ -86,7 +86,7 @@ def test_restock_itemprop_basic(client, live_server): delete_all_watches(client) -def test_itemprop_price_change(client, live_server): +def test_itemprop_price_change(client, live_server, measure_memory_usage): # Out of the box 'Follow price changes' should be ON @@ -211,7 +211,7 @@ def _run_test_minmax_limit(client, extra_watch_edit_form): delete_all_watches(client) -def test_restock_itemprop_minmax(client, live_server): +def test_restock_itemprop_minmax(client, live_server, measure_memory_usage): extras = { "restock_settings-follow_price_changes": "y", @@ -220,7 +220,7 @@ def test_restock_itemprop_minmax(client, live_server): } _run_test_minmax_limit(client, extra_watch_edit_form=extras) -def test_restock_itemprop_with_tag(client, live_server): +def test_restock_itemprop_with_tag(client, live_server, measure_memory_usage): res = client.post( @@ -249,7 +249,7 @@ def test_restock_itemprop_with_tag(client, live_server): -def test_itemprop_percent_threshold(client, live_server): +def test_itemprop_percent_threshold(client, live_server, measure_memory_usage): delete_all_watches(client) @@ -315,7 +315,7 @@ def test_itemprop_percent_threshold(client, live_server): -def test_change_with_notification_values(client, live_server): +def test_change_with_notification_values(client, live_server, measure_memory_usage): if os.path.isfile("test-datastore/notification.txt"): @@ -383,7 +383,7 @@ def test_change_with_notification_values(client, live_server): assert os.path.isfile("test-datastore/notification.txt"), "Notification received" -def test_data_sanity(client, live_server): +def test_data_sanity(client, live_server, measure_memory_usage): delete_all_watches(client) @@ -429,7 +429,7 @@ def test_data_sanity(client, live_server): delete_all_watches(client) # All examples should give a prive of 666.66 -def test_special_prop_examples(client, live_server): +def test_special_prop_examples(client, live_server, measure_memory_usage): import glob diff --git a/changedetectionio/tests/test_rss.py b/changedetectionio/tests/test_rss.py index 38d55863..694fe891 100644 --- a/changedetectionio/tests/test_rss.py +++ b/changedetectionio/tests/test_rss.py @@ -178,7 +178,7 @@ def test_rss_xpath_filtering(client, live_server, measure_memory_usage): delete_all_watches(client) -def test_rss_bad_chars_breaking(client, live_server): +def test_rss_bad_chars_breaking(client, live_server, measure_memory_usage): """This should absolutely trigger the RSS builder to go into worst state mode - source: prefix means no html conversion (which kinda filters out the bad stuff) diff --git a/changedetectionio/tests/test_scheduler.py b/changedetectionio/tests/test_scheduler.py index 9436a204..726423f3 100644 --- a/changedetectionio/tests/test_scheduler.py +++ b/changedetectionio/tests/test_scheduler.py @@ -9,7 +9,7 @@ from .util import live_server_setup, wait_for_all_checks, extract_UUID_from_cli from ..forms import REQUIRE_ATLEAST_ONE_TIME_PART_MESSAGE_DEFAULT, REQUIRE_ATLEAST_ONE_TIME_PART_WHEN_NOT_GLOBAL_DEFAULT -# def test_setup(client, live_server): +# def test_setup(client, live_server, measure_memory_usage): # live_server_setup(live_server) # Setup on conftest per function def test_check_basic_scheduler_functionality(client, live_server, measure_memory_usage): diff --git a/changedetectionio/tests/test_ui.py b/changedetectionio/tests/test_ui.py index b69053b7..9f7715fe 100644 --- a/changedetectionio/tests/test_ui.py +++ b/changedetectionio/tests/test_ui.py @@ -5,7 +5,7 @@ from .util import set_original_response, set_modified_response, live_server_setu from ..forms import REQUIRE_ATLEAST_ONE_TIME_PART_WHEN_NOT_GLOBAL_DEFAULT, REQUIRE_ATLEAST_ONE_TIME_PART_MESSAGE_DEFAULT -def test_recheck_time_field_validation_global_settings(client, live_server): +def test_recheck_time_field_validation_global_settings(client, live_server, measure_memory_usage): """ Tests that the global settings time field has atleast one value for week/day/hours/minute/seconds etc entered class globalSettingsRequestForm(Form): @@ -27,7 +27,7 @@ def test_recheck_time_field_validation_global_settings(client, live_server): assert REQUIRE_ATLEAST_ONE_TIME_PART_MESSAGE_DEFAULT.encode('utf-8') in res.data -def test_recheck_time_field_validation_single_watch(client, live_server): +def test_recheck_time_field_validation_single_watch(client, live_server, measure_memory_usage): """ Tests that the global settings time field has atleast one value for week/day/hours/minute/seconds etc entered class globalSettingsRequestForm(Form): @@ -95,7 +95,7 @@ def test_recheck_time_field_validation_single_watch(client, live_server): assert b"Updated watch." in res.data assert REQUIRE_ATLEAST_ONE_TIME_PART_WHEN_NOT_GLOBAL_DEFAULT.encode('utf-8') not in res.data -def test_checkbox_open_diff_in_new_tab(client, live_server): +def test_checkbox_open_diff_in_new_tab(client, live_server, measure_memory_usage): set_original_response() # Add our URL to the import page @@ -168,7 +168,7 @@ def test_checkbox_open_diff_in_new_tab(client, live_server): # Cleanup everything delete_all_watches(client) -def test_page_title_listing_behaviour(client, live_server): +def test_page_title_listing_behaviour(client, live_server, measure_memory_usage): set_original_response(extra_title="custom html") @@ -243,7 +243,7 @@ def test_page_title_listing_behaviour(client, live_server): assert b"head titlecustom html" in res.data -def test_ui_viewed_unread_flag(client, live_server): +def test_ui_viewed_unread_flag(client, live_server, measure_memory_usage): import time diff --git a/changedetectionio/tests/test_xpath_selector.py b/changedetectionio/tests/test_xpath_selector.py index 356b91b9..105bcaf3 100644 --- a/changedetectionio/tests/test_xpath_selector.py +++ b/changedetectionio/tests/test_xpath_selector.py @@ -584,7 +584,7 @@ def _subtest_xpath_rss(client, content_type='text/html'): client.get(url_for("ui.form_delete", uuid="all"), follow_redirects=True) # Be sure all-in-the-wild types of RSS feeds work with xpath -def test_rss_xpath(client, live_server): +def test_rss_xpath(client, live_server, measure_memory_usage): for feed_header in ['', '']: set_rss_atom_feed_response(header=feed_header) for content_type in RSS_XML_CONTENT_TYPES: diff --git a/changedetectionio/tests/visualselector/test_fetch_data.py b/changedetectionio/tests/visualselector/test_fetch_data.py index f0249eca..dedef9a3 100644 --- a/changedetectionio/tests/visualselector/test_fetch_data.py +++ b/changedetectionio/tests/visualselector/test_fetch_data.py @@ -4,7 +4,7 @@ import os from flask import url_for from ..util import live_server_setup, wait_for_all_checks -# def test_setup(client, live_server): +# def test_setup(client, live_server, measure_memory_usage): # live_server_setup(live_server) # Setup on conftest per function @@ -142,7 +142,7 @@ def test_basic_browserstep(client, live_server, measure_memory_usage): assert b"testheader: yes" in res.data assert b"user-agent: mycustomagent" in res.data -def test_non_200_errors_report_browsersteps(client, live_server): +def test_non_200_errors_report_browsersteps(client, live_server, measure_memory_usage): four_o_four_url = url_for('test_endpoint', status_code=404, _external=True)