removing some delays

test-speedups
dgtlmoon 7 months ago
parent 8104b63775
commit 7285913b34

@ -53,7 +53,6 @@ def test_restock_detection(client, live_server):
set_original_response() set_original_response()
#assert os.getenv('PLAYWRIGHT_DRIVER_URL'), "Needs PLAYWRIGHT_DRIVER_URL set for this test" #assert os.getenv('PLAYWRIGHT_DRIVER_URL'), "Needs PLAYWRIGHT_DRIVER_URL set for this test"
time.sleep(1)
live_server_setup(live_server) live_server_setup(live_server)
##################### #####################
notification_url = url_for('test_notification_endpoint', _external=True).replace('http://localhost', 'http://changedet').replace('http', 'json') notification_url = url_for('test_notification_endpoint', _external=True).replace('http://localhost', 'http://changedet').replace('http', 'json')

@ -40,8 +40,6 @@ def test_setup(client, live_server):
def test_check_removed_line_contains_trigger(client, live_server): def test_check_removed_line_contains_trigger(client, live_server):
# Give the endpoint time to spin up
time.sleep(1)
set_original() set_original()
# Add our URL to the import page # Add our URL to the import page
test_url = url_for('test_endpoint', _external=True) test_url = url_for('test_endpoint', _external=True)

@ -2,13 +2,12 @@
import time import time
from flask import url_for from flask import url_for
from . util import live_server_setup from .util import live_server_setup, wait_for_all_checks
def test_basic_auth(client, live_server): def test_basic_auth(client, live_server):
live_server_setup(live_server) live_server_setup(live_server)
# Give the endpoint time to spin up
time.sleep(1)
# Add our URL to the import page # Add our URL to the import page
test_url = url_for('test_basicauth_method', _external=True).replace("//","//myuser:mypass@") test_url = url_for('test_basicauth_method', _external=True).replace("//","//myuser:mypass@")
@ -19,7 +18,7 @@ def test_basic_auth(client, live_server):
follow_redirects=True follow_redirects=True
) )
assert b"1 Imported" in res.data assert b"1 Imported" in res.data
time.sleep(1) wait_for_all_checks(client)
# Check form validation # Check form validation
res = client.post( res = client.post(
@ -29,7 +28,7 @@ def test_basic_auth(client, live_server):
) )
assert b"Updated watch." in res.data assert b"Updated watch." in res.data
time.sleep(1) wait_for_all_checks(client)
res = client.get( res = client.get(
url_for("preview_page", uuid="first"), url_for("preview_page", uuid="first"),
follow_redirects=True follow_redirects=True

@ -104,8 +104,6 @@ def test_check_ldjson_price_autodetect(client, live_server):
client.get(url_for('price_data_follower.accept', uuid=uuid, follow_redirects=True)) client.get(url_for('price_data_follower.accept', uuid=uuid, follow_redirects=True))
wait_for_all_checks(client) wait_for_all_checks(client)
# Trigger a check
time.sleep(1)
client.get(url_for("form_watch_checknow"), follow_redirects=True) client.get(url_for("form_watch_checknow"), follow_redirects=True)
wait_for_all_checks(client) wait_for_all_checks(client)
# Offer should be gone # Offer should be gone

@ -13,9 +13,6 @@ def test_backup(client, live_server):
set_original_response() set_original_response()
# Give the endpoint time to spin up
time.sleep(1)
# Add our URL to the import page # Add our URL to the import page
res = client.post( res = client.post(
url_for("import_page"), url_for("import_page"),

@ -68,8 +68,6 @@ def test_check_block_changedetection_text_NOT_present(client, live_server):
set_original_ignore_response() set_original_ignore_response()
# Give the endpoint time to spin up
time.sleep(1)
# Add our URL to the import page # Add our URL to the import page
test_url = url_for('test_endpoint', _external=True) test_url = url_for('test_endpoint', _external=True)

@ -10,9 +10,6 @@ def test_trigger_functionality(client, live_server):
live_server_setup(live_server) live_server_setup(live_server)
# Give the endpoint time to spin up
time.sleep(1)
# Add our URL to the import page # Add our URL to the import page
res = client.post( res = client.post(
url_for("import_page"), url_for("import_page"),

@ -77,9 +77,6 @@ def test_check_markup_include_filters_restriction(client, live_server):
set_original_response() set_original_response()
# Give the endpoint time to spin up
time.sleep(1)
# Add our URL to the import page # Add our URL to the import page
test_url = url_for('test_endpoint', _external=True) test_url = url_for('test_endpoint', _external=True)
res = client.post( res = client.post(
@ -89,8 +86,7 @@ def test_check_markup_include_filters_restriction(client, live_server):
) )
assert b"1 Imported" in res.data assert b"1 Imported" in res.data
# Give the thread time to pick it up wait_for_all_checks(client)
time.sleep(sleep_time_for_fetch_thread)
# Goto the edit page, add our ignore text # Goto the edit page, add our ignore text
# Add our URL to the import page # Add our URL to the import page
@ -100,22 +96,22 @@ def test_check_markup_include_filters_restriction(client, live_server):
follow_redirects=True follow_redirects=True
) )
assert b"Updated watch." in res.data assert b"Updated watch." in res.data
time.sleep(1) wait_for_all_checks(client)
# Check it saved # Check it saved
res = client.get( res = client.get(
url_for("edit_page", uuid="first"), url_for("edit_page", uuid="first"),
) )
assert bytes(include_filters.encode('utf-8')) in res.data assert bytes(include_filters.encode('utf-8')) in res.data
# Give the thread time to pick it up
time.sleep(sleep_time_for_fetch_thread) wait_for_all_checks(client)
# Make a change # Make a change
set_modified_response() set_modified_response()
# Trigger a check # Trigger a check
client.get(url_for("form_watch_checknow"), follow_redirects=True) client.get(url_for("form_watch_checknow"), follow_redirects=True)
# Give the thread time to pick it up # Give the thread time to pick it up
time.sleep(sleep_time_for_fetch_thread) wait_for_all_checks(client)
# It should have 'unviewed' still # It should have 'unviewed' still
# Because it should be looking at only that 'sametext' id # Because it should be looking at only that 'sametext' id
@ -138,8 +134,6 @@ def test_check_multiple_filters(client, live_server):
</html> </html>
""") """)
# Give the endpoint time to spin up
time.sleep(1)
# Add our URL to the import page # Add our URL to the import page
test_url = url_for('test_endpoint', _external=True) test_url = url_for('test_endpoint', _external=True)
@ -149,7 +143,7 @@ def test_check_multiple_filters(client, live_server):
follow_redirects=True follow_redirects=True
) )
assert b"1 Imported" in res.data assert b"1 Imported" in res.data
time.sleep(1) wait_for_all_checks(client)
# Goto the edit page, add our ignore text # Goto the edit page, add our ignore text
# Add our URL to the import page # Add our URL to the import page
@ -164,9 +158,7 @@ def test_check_multiple_filters(client, live_server):
) )
assert b"Updated watch." in res.data assert b"Updated watch." in res.data
# Give the thread time to pick it up wait_for_all_checks(client)
time.sleep(sleep_time_for_fetch_thread)
res = client.get( res = client.get(
url_for("preview_page", uuid="first"), url_for("preview_page", uuid="first"),
follow_redirects=True follow_redirects=True

@ -5,7 +5,7 @@ import time
from flask import url_for from flask import url_for
from ..html_tools import * from ..html_tools import *
from .util import live_server_setup from .util import live_server_setup, wait_for_all_checks
def test_setup(live_server): def test_setup(live_server):
@ -111,16 +111,13 @@ def test_element_removal_full(client, live_server):
set_original_response() set_original_response()
# Give the endpoint time to spin up
time.sleep(1)
# Add our URL to the import page # Add our URL to the import page
test_url = url_for("test_endpoint", _external=True) test_url = url_for("test_endpoint", _external=True)
res = client.post( res = client.post(
url_for("import_page"), data={"urls": test_url}, follow_redirects=True url_for("import_page"), data={"urls": test_url}, follow_redirects=True
) )
assert b"1 Imported" in res.data assert b"1 Imported" in res.data
time.sleep(1) wait_for_all_checks(client)
# Goto the edit page, add the filter data # Goto the edit page, add the filter data
# Not sure why \r needs to be added - absent of the #changetext this is not necessary # Not sure why \r needs to be added - absent of the #changetext this is not necessary
subtractive_selectors_data = "header\r\nfooter\r\nnav\r\n#changetext" subtractive_selectors_data = "header\r\nfooter\r\nnav\r\n#changetext"

@ -27,9 +27,6 @@ def set_html_response():
def test_check_encoding_detection(client, live_server): def test_check_encoding_detection(client, live_server):
set_html_response() set_html_response()
# Give the endpoint time to spin up
time.sleep(1)
# Add our URL to the import page # Add our URL to the import page
test_url = url_for('test_endpoint', content_type="text/html", _external=True) test_url = url_for('test_endpoint', content_type="text/html", _external=True)
client.post( client.post(
@ -56,9 +53,6 @@ def test_check_encoding_detection(client, live_server):
def test_check_encoding_detection_missing_content_type_header(client, live_server): def test_check_encoding_detection_missing_content_type_header(client, live_server):
set_html_response() set_html_response()
# Give the endpoint time to spin up
time.sleep(1)
# Add our URL to the import page # Add our URL to the import page
test_url = url_for('test_endpoint', _external=True) test_url = url_for('test_endpoint', _external=True)
client.post( client.post(

@ -64,8 +64,6 @@ def test_http_error_handler(client, live_server):
# Just to be sure error text is properly handled # Just to be sure error text is properly handled
def test_DNS_errors(client, live_server): def test_DNS_errors(client, live_server):
# Give the endpoint time to spin up
time.sleep(1)
# Add our URL to the import page # Add our URL to the import page
res = client.post( res = client.post(
@ -89,8 +87,6 @@ def test_DNS_errors(client, live_server):
# Re 1513 # Re 1513
def test_low_level_errors_clear_correctly(client, live_server): def test_low_level_errors_clear_correctly(client, live_server):
#live_server_setup(live_server) #live_server_setup(live_server)
# Give the endpoint time to spin up
time.sleep(1)
with open("test-datastore/endpoint-content.txt", "w") as f: with open("test-datastore/endpoint-content.txt", "w") as f:
f.write("<html><body><div id=here>Hello world</div></body></html>") f.write("<html><body><div id=here>Hello world</div></body></html>")

@ -48,8 +48,6 @@ def test_filter_doesnt_exist_then_exists_should_get_notification(client, live_se
live_server_setup(live_server) live_server_setup(live_server)
# Give the endpoint time to spin up
time.sleep(1)
set_response_without_filter() set_response_without_filter()
# Add our URL to the import page # Add our URL to the import page

@ -23,8 +23,7 @@ def set_response_with_filter():
def run_filter_test(client, content_filter): def run_filter_test(client, content_filter):
# Give the endpoint time to spin up wait_for_all_checks(client)
time.sleep(1)
# cleanup for the next # cleanup for the next
client.get( client.get(
url_for("form_delete", uuid="all"), url_for("form_delete", uuid="all"),

@ -11,8 +11,6 @@ from urllib.parse import urlparse, parse_qs
def test_consistent_history(client, live_server): def test_consistent_history(client, live_server):
live_server_setup(live_server) live_server_setup(live_server)
# Give the endpoint time to spin up
time.sleep(1)
r = range(1, 50) r = range(1, 50)
for one in r: for one in r:

@ -45,9 +45,6 @@ def test_render_anchor_tag_content_true(client, live_server):
render_anchor_tag_content setting is set to true""" render_anchor_tag_content setting is set to true"""
sleep_time_for_fetch_thread = 3 sleep_time_for_fetch_thread = 3
# Give the endpoint time to spin up
time.sleep(1)
# set original html text # set original html text
set_original_ignore_response() set_original_ignore_response()

@ -125,12 +125,11 @@ def wait_for_all_checks(client):
attempt=0 attempt=0
time.sleep(0.1) time.sleep(0.1)
while attempt < 60: while attempt < 60:
time.sleep(1)
res = client.get(url_for("index")) res = client.get(url_for("index"))
if not b'Checking now' in res.data: if not b'Checking now' in res.data:
break break
logging.getLogger().info("Waiting for watch-list to not say 'Checking now'.. {}".format(attempt)) logging.getLogger().info("Waiting for watch-list to not say 'Checking now'.. {}".format(attempt))
time.sleep(1)
attempt += 1 attempt += 1
def live_server_setup(live_server): def live_server_setup(live_server):

Loading…
Cancel
Save