From 3bfe439ba27912e3d3532146ec6d592c21520d56 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Wed, 9 Oct 2024 15:58:04 -0500 Subject: [PATCH 1/8] Add testing for Python 3.13 Fixes https://github.com/con/duct/issues/157 --- .github/workflows/test.yaml | 1 + setup.cfg | 1 + tox.ini | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7191b5fd..9c29cc2f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -35,6 +35,7 @@ jobs: - '3.10' - '3.11' - '3.12' + - '3.13' - 'pypy-3.9' - 'pypy-3.10' toxenv: [py] diff --git a/setup.cfg b/setup.cfg index ac44a9a3..bfcf8339 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,6 +30,7 @@ classifiers = Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 + Programming Language :: Python :: 3.13 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy License :: OSI Approved :: MIT License diff --git a/tox.ini b/tox.ini index 2daef3c6..3f0b9f7f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = lint,typing,py38,py39,py310,py311,py312,pypy3 +envlist = lint,typing,py39,py310,py311,py312,py313,pypy3 skip_missing_interpreters = True isolated_build = True minversion = 3.3.0 From fdac2414c6ff85e84ba39e94dbdf4742932033a6 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Mon, 14 Oct 2024 16:51:09 -0500 Subject: [PATCH 2/8] DO NOT MERGE sanity check lets wait a whole second just to see what happens --- test/test_execution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_execution.py b/test/test_execution.py index 871a7d15..c5e83a54 100644 --- a/test/test_execution.py +++ b/test/test_execution.py @@ -213,7 +213,7 @@ def runner() -> int: thread = threading.Thread(target=runner) thread.start() - sleep(0.3) # make sure the process is started + sleep(1) # make sure the process is started ps_command = "ps aux | grep '[s]leep 60.74016230000801'" # brackets to not match grep process ps_output = subprocess.check_output(ps_command, shell=True).decode() pid = int(ps_output.split()[1]) From 142b74ccca5c0bbe262efd535e5a6a2d97aedbcc Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Tue, 15 Oct 2024 11:06:33 -0500 Subject: [PATCH 3/8] Add retry logic --- test/test_execution.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/test/test_execution.py b/test/test_execution.py index c5e83a54..b2bb4ce5 100644 --- a/test/test_execution.py +++ b/test/test_execution.py @@ -213,11 +213,22 @@ def runner() -> int: thread = threading.Thread(target=runner) thread.start() - sleep(1) # make sure the process is started - ps_command = "ps aux | grep '[s]leep 60.74016230000801'" # brackets to not match grep process - ps_output = subprocess.check_output(ps_command, shell=True).decode() - pid = int(ps_output.split()[1]) - os.kill(pid, signal.SIGTERM) + retries = 5 + pid = None + for i in range(retries): + try: + ps_command = "ps aux | grep '[s]leep 60.74016230000801'" # brackets to not match grep process + ps_output = subprocess.check_output(ps_command, shell=True).decode() + pid = int(ps_output.split()[1]) + break + except subprocess.CalledProcessError as e: + print(f"Attempt {i} failed with msg: {e.msg}", file=sys.stderr) + sleep(0.1) # Retry after a short delay + + if pid is not None: + os.kill(pid, signal.SIGTERM) + else: + raise RuntimeError("Failed to find sleep process") thread.join() # Cannot retrieve the exit code from the thread, it is written to the file From dea529ff4756011522001a1119bb2fc74baae058 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Tue, 15 Oct 2024 11:11:59 -0500 Subject: [PATCH 4/8] Fixup: dumb e --- test/test_execution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_execution.py b/test/test_execution.py index b2bb4ce5..b27d6ad0 100644 --- a/test/test_execution.py +++ b/test/test_execution.py @@ -222,7 +222,7 @@ def runner() -> int: pid = int(ps_output.split()[1]) break except subprocess.CalledProcessError as e: - print(f"Attempt {i} failed with msg: {e.msg}", file=sys.stderr) + print(f"Attempt {i} failed with msg: {e}", file=sys.stderr) sleep(0.1) # Retry after a short delay if pid is not None: From 9ebbbd73e578bd832d677310522ec73e2f2d0a85 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Tue, 15 Oct 2024 11:16:27 -0500 Subject: [PATCH 5/8] BRUTE FORCE attempt --- test/test_execution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_execution.py b/test/test_execution.py index b27d6ad0..5101ca9e 100644 --- a/test/test_execution.py +++ b/test/test_execution.py @@ -213,7 +213,7 @@ def runner() -> int: thread = threading.Thread(target=runner) thread.start() - retries = 5 + retries = 20 pid = None for i in range(retries): try: From 2c66d2f9acbf8a816f474958aa2a3ff6f3e30e04 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Thu, 24 Oct 2024 10:29:09 -0500 Subject: [PATCH 6/8] TMP: add debug output for 3.13 test --- test/test_execution.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test_execution.py b/test/test_execution.py index 5101ca9e..da42762e 100644 --- a/test/test_execution.py +++ b/test/test_execution.py @@ -223,6 +223,8 @@ def runner() -> int: break except subprocess.CalledProcessError as e: print(f"Attempt {i} failed with msg: {e}", file=sys.stderr) + debug_ps_output = subprocess.check_output("ps aux", shell=True).decode() + print(f"Output of ps aux: {debug_ps_output}", file=sys.stderr) sleep(0.1) # Retry after a short delay if pid is not None: From 8bab6d454acc3ffb82180c37d1c04cbc538be599 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Thu, 24 Oct 2024 12:45:36 -0500 Subject: [PATCH 7/8] Avoid ps aux command truncation Weird that this only happens on python3.13 though --- test/test_execution.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_execution.py b/test/test_execution.py index da42762e..e9043e53 100644 --- a/test/test_execution.py +++ b/test/test_execution.py @@ -217,13 +217,13 @@ def runner() -> int: pid = None for i in range(retries): try: - ps_command = "ps aux | grep '[s]leep 60.74016230000801'" # brackets to not match grep process + ps_command = "ps auxww | grep '[s]leep 60.74016230000801'" # brackets to not match grep process ps_output = subprocess.check_output(ps_command, shell=True).decode() pid = int(ps_output.split()[1]) break except subprocess.CalledProcessError as e: print(f"Attempt {i} failed with msg: {e}", file=sys.stderr) - debug_ps_output = subprocess.check_output("ps aux", shell=True).decode() + debug_ps_output = subprocess.check_output("ps auxww", shell=True).decode() print(f"Output of ps aux: {debug_ps_output}", file=sys.stderr) sleep(0.1) # Retry after a short delay From 320f0afc5c5fc5bdaa086f696cd81dd41c10c71d Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Thu, 24 Oct 2024 13:37:40 -0500 Subject: [PATCH 8/8] Remove temporary debug messages --- test/test_execution.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/test_execution.py b/test/test_execution.py index e9043e53..2042cdfc 100644 --- a/test/test_execution.py +++ b/test/test_execution.py @@ -223,8 +223,6 @@ def runner() -> int: break except subprocess.CalledProcessError as e: print(f"Attempt {i} failed with msg: {e}", file=sys.stderr) - debug_ps_output = subprocess.check_output("ps auxww", shell=True).decode() - print(f"Output of ps aux: {debug_ps_output}", file=sys.stderr) sleep(0.1) # Retry after a short delay if pid is not None: