From 04a764c708c7546ec68a672bbc1a2a7669893bca Mon Sep 17 00:00:00 2001 From: Eduardo Chauca Date: Thu, 16 Oct 2025 10:26:27 -0500 Subject: [PATCH 1/7] test CI --- python/tk_desktop/licenses.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/tk_desktop/licenses.html b/python/tk_desktop/licenses.html index 4456886b..99e85233 100644 --- a/python/tk_desktop/licenses.html +++ b/python/tk_desktop/licenses.html @@ -14,7 +14,9 @@ accepted upon access or use of this Service or made available on the Autodesk webpage. Autodesk terms of service for Autodesk's various web services can be found - here. + + here + .

From c24f606d53de1ea306a0cffa0e9b78fc0d24376a Mon Sep 17 00:00:00 2001 From: Eduardo Chauca Date: Thu, 16 Oct 2025 10:35:46 -0500 Subject: [PATCH 2/7] improving test --- python/tk_desktop/licenses.html | 4 +-- tests/test_about_box.py | 47 ++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/python/tk_desktop/licenses.html b/python/tk_desktop/licenses.html index 99e85233..4456886b 100644 --- a/python/tk_desktop/licenses.html +++ b/python/tk_desktop/licenses.html @@ -14,9 +14,7 @@ accepted upon access or use of this Service or made available on the Autodesk webpage. Autodesk terms of service for Autodesk's various web services can be found - - here - . + here.

diff --git a/tests/test_about_box.py b/tests/test_about_box.py index 3fffdf61..6542d4c5 100644 --- a/tests/test_about_box.py +++ b/tests/test_about_box.py @@ -65,35 +65,44 @@ def test_3rd_party_links(licence_file_links): Check all found urls are valid and can accessed. """ max_retries = 5 - error_message = "" + for url in licence_file_links: retry_delay = 1 - for _ in range(max_retries): + last_error = None + + for attempt in range(max_retries): try: r = request.Request( url, - headers={"Accept-Language": "en", "User-Agent": "Mozilla/5.0"}, + headers={ + "Accept-Language": "en", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" + }, ) - - contents = request.urlopen(r).read() + + contents = request.urlopen(r, timeout=10).read() + # Success - break out of retry loop break + except Exception as e: - time.sleep(retry_delay) - retry_delay *= 2 + last_error = e error_message = str(e) - else: - # If all retries fail, raise an exception - if "403: Forbidden" in error_message: - pytest.skip( - "Failed to open {0}, error: {1}. This is likely due to GitHub " - "blocking the request. Please check the URL in a web browser.".format( - url, error_message + + # If it's a 403, it's likely not going to resolve with retries + if "403" in error_message or "Forbidden" in error_message: + pytest.skip( + f"Failed to open {url}, error: {error_message}. " + "This is likely due to the site blocking automated requests. " + "Please check the URL manually in a web browser." ) - ) - - raise pytest.fail( - "Failed to open {0}, error: {1}".format(url, error_message) - ) + + # For other errors, retry with exponential backoff + if attempt < max_retries - 1: # Don't sleep on last attempt + time.sleep(retry_delay) + retry_delay *= 2 + else: + # All retries exhausted + raise pytest.fail(f"Failed to open {url} after {max_retries} attempts, error: {last_error}") @pytest.mark.parametrize( From a029cd72ce2b1694490005600f70b1b0b3056415 Mon Sep 17 00:00:00 2001 From: Eduardo Chauca Date: Thu, 16 Oct 2025 10:44:42 -0500 Subject: [PATCH 3/7] increasing delay time --- tests/test_about_box.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/test_about_box.py b/tests/test_about_box.py index 6542d4c5..938923bf 100644 --- a/tests/test_about_box.py +++ b/tests/test_about_box.py @@ -64,10 +64,10 @@ def test_3rd_party_links(licence_file_links): """ Check all found urls are valid and can accessed. """ - max_retries = 5 + max_retries = 8 for url in licence_file_links: - retry_delay = 1 + retry_delay = 2 last_error = None for attempt in range(max_retries): @@ -80,7 +80,7 @@ def test_3rd_party_links(licence_file_links): }, ) - contents = request.urlopen(r, timeout=10).read() + contents = request.urlopen(r, timeout=20).read() # Success - break out of retry loop break @@ -90,16 +90,21 @@ def test_3rd_party_links(licence_file_links): # If it's a 403, it's likely not going to resolve with retries if "403" in error_message or "Forbidden" in error_message: - pytest.skip( - f"Failed to open {url}, error: {error_message}. " - "This is likely due to the site blocking automated requests. " - "Please check the URL manually in a web browser." - ) + if attempt < 3: # Give it 3 attempts before skipping + time.sleep(retry_delay) + retry_delay = min(retry_delay * 2, 30) # Cap at 30 seconds + continue + else: + pytest.skip( + f"Failed to open {url}, error: {error_message}. " + "This is likely due to the site blocking automated requests. " + "Please check the URL manually in a web browser." + ) # For other errors, retry with exponential backoff if attempt < max_retries - 1: # Don't sleep on last attempt time.sleep(retry_delay) - retry_delay *= 2 + retry_delay *= min(retry_delay * 2, 30) else: # All retries exhausted raise pytest.fail(f"Failed to open {url} after {max_retries} attempts, error: {last_error}") From 1e3d1ca21bb81688aff1fa5fe67d776f1946a987 Mon Sep 17 00:00:00 2001 From: Eduardo Chauca Date: Fri, 17 Oct 2025 16:15:57 -0500 Subject: [PATCH 4/7] test --- tests/test_about_box.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_about_box.py b/tests/test_about_box.py index 938923bf..78f6caa9 100644 --- a/tests/test_about_box.py +++ b/tests/test_about_box.py @@ -80,7 +80,7 @@ def test_3rd_party_links(licence_file_links): }, ) - contents = request.urlopen(r, timeout=20).read() + contents = request.urlopen(r, timeout=80).read() # Success - break out of retry loop break From 0fa43d05e66fdda61c855030bf3138a08ab1bbf0 Mon Sep 17 00:00:00 2001 From: Eduardo Chauca Date: Fri, 17 Oct 2025 16:21:11 -0500 Subject: [PATCH 5/7] test --- tests/test_about_box.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/test_about_box.py b/tests/test_about_box.py index 78f6caa9..611795ed 100644 --- a/tests/test_about_box.py +++ b/tests/test_about_box.py @@ -65,29 +65,29 @@ def test_3rd_party_links(licence_file_links): Check all found urls are valid and can accessed. """ max_retries = 8 - + for url in licence_file_links: retry_delay = 2 last_error = None - + for attempt in range(max_retries): try: r = request.Request( url, headers={ - "Accept-Language": "en", - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" + "Accept-Language": "en", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", }, ) - + contents = request.urlopen(r, timeout=80).read() # Success - break out of retry loop break - + except Exception as e: last_error = e error_message = str(e) - + # If it's a 403, it's likely not going to resolve with retries if "403" in error_message or "Forbidden" in error_message: if attempt < 3: # Give it 3 attempts before skipping @@ -100,14 +100,16 @@ def test_3rd_party_links(licence_file_links): "This is likely due to the site blocking automated requests. " "Please check the URL manually in a web browser." ) - + # For other errors, retry with exponential backoff if attempt < max_retries - 1: # Don't sleep on last attempt time.sleep(retry_delay) retry_delay *= min(retry_delay * 2, 30) else: # All retries exhausted - raise pytest.fail(f"Failed to open {url} after {max_retries} attempts, error: {last_error}") + raise pytest.fail( + f"Failed to open {url} after {max_retries} attempts, error: {last_error}" + ) @pytest.mark.parametrize( From 5e0113eb27c0ee98af774e648a8c74a93d2a14b7 Mon Sep 17 00:00:00 2001 From: Eduardo Chauca Date: Fri, 17 Oct 2025 16:47:01 -0500 Subject: [PATCH 6/7] test --- tests/test_about_box.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_about_box.py b/tests/test_about_box.py index 611795ed..c92853b1 100644 --- a/tests/test_about_box.py +++ b/tests/test_about_box.py @@ -61,6 +61,7 @@ def handle_starttag(self, tag, attrs): def test_3rd_party_links(licence_file_links): + print("licence_file_links:", licence_file_links) """ Check all found urls are valid and can accessed. """ @@ -80,7 +81,7 @@ def test_3rd_party_links(licence_file_links): }, ) - contents = request.urlopen(r, timeout=80).read() + contents = request.urlopen(r, timeout=120).read() # Success - break out of retry loop break From 823a7b447b6e91faaffd727a9fe79fc0d3573c06 Mon Sep 17 00:00:00 2001 From: Eduardo Chauca Date: Fri, 17 Oct 2025 17:01:24 -0500 Subject: [PATCH 7/7] test --- tests/test_about_box.py | 62 +++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/tests/test_about_box.py b/tests/test_about_box.py index c92853b1..f2c4a1f4 100644 --- a/tests/test_about_box.py +++ b/tests/test_about_box.py @@ -61,15 +61,23 @@ def handle_starttag(self, tag, attrs): def test_3rd_party_links(licence_file_links): - print("licence_file_links:", licence_file_links) """ Check all found urls are valid and can accessed. """ max_retries = 8 + failed_urls = [] + skipped_urls = [] + + # Use pytest warnings - always shown + pytest.warns(UserWarning, match=".*") # Enable warnings + + import warnings + warnings.warn(f"Testing {len(licence_file_links)} URLs") for url in licence_file_links: retry_delay = 2 last_error = None + url_succeeded = False for attempt in range(max_retries): try: @@ -81,37 +89,43 @@ def test_3rd_party_links(licence_file_links): }, ) - contents = request.urlopen(r, timeout=120).read() - # Success - break out of retry loop + contents = request.urlopen(r, timeout=30).read() + url_succeeded = True + warnings.warn(f"SUCCESS: {url}") break except Exception as e: last_error = e error_message = str(e) - # If it's a 403, it's likely not going to resolve with retries if "403" in error_message or "Forbidden" in error_message: - if attempt < 3: # Give it 3 attempts before skipping - time.sleep(retry_delay) - retry_delay = min(retry_delay * 2, 30) # Cap at 30 seconds - continue - else: - pytest.skip( - f"Failed to open {url}, error: {error_message}. " - "This is likely due to the site blocking automated requests. " - "Please check the URL manually in a web browser." - ) - - # For other errors, retry with exponential backoff - if attempt < max_retries - 1: # Don't sleep on last attempt + skipped_urls.append({ + 'url': url, + 'error': error_message + }) + warnings.warn(f"SKIPPED (403): {url}") + url_succeeded = True + break + + if attempt < max_retries - 1: time.sleep(retry_delay) - retry_delay *= min(retry_delay * 2, 30) - else: - # All retries exhausted - raise pytest.fail( - f"Failed to open {url} after {max_retries} attempts, error: {last_error}" - ) - + retry_delay = min(retry_delay * 2, 30) + + if not url_succeeded: + failed_urls.append({ + 'url': url, + 'error': str(last_error) + }) + warnings.warn(f"FAILED: {url} - {last_error}") + + if skipped_urls: + warnings.warn(f"{len(skipped_urls)} URLs skipped due to 403 errors") + + if failed_urls: + error_msg = f"\n{len(failed_urls)} URL(s) failed after {max_retries} retries:\n" + for item in failed_urls: + error_msg += f" - {item['url']}\n Error: {item['error']}\n" + pytest.fail(error_msg) @pytest.mark.parametrize( "expected_url",