Skip to content

Commit

Permalink
WIP: Debug github actions PyPy interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
deajan committed Dec 28, 2023
1 parent c40105c commit c8421bb
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions tests/test_command_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ def running_on_github_actions():
return os.environ.get("RUNNING_ON_GITHUB_ACTIONS") == "true" # bash 'true'


def test_standard_ping_with_encoding():
def test_interpreter():
print("PLATFORM INTERPRETER", platform.python_implementation())


def xtest_standard_ping_with_encoding():
"""
Test command_runner with a standard ping and encoding parameter
"""
Expand All @@ -115,7 +119,7 @@ def test_standard_ping_with_encoding():
assert exit_code == 0, 'Exit code should be 0 for ping command with method {}'.format(method)


def test_standard_ping_with_default_encoding():
def xtest_standard_ping_with_default_encoding():
"""
Without encoding, iter(stream.readline, '') will hang since the expected sentinel char would be b'':
This could only happen on python <3.6 since command_runner decides to use an encoding anyway
Expand All @@ -126,7 +130,7 @@ def test_standard_ping_with_default_encoding():
assert exit_code == 0, 'Exit code should be 0 for ping command with method {}'.format(method)


def test_standard_ping_with_encoding_disabled():
def xtest_standard_ping_with_encoding_disabled():
"""
Without encoding disabled, we should have binary output
"""
Expand All @@ -137,7 +141,7 @@ def test_standard_ping_with_encoding_disabled():
assert isinstance(output, bytes), 'Output should be binary.'


def test_timeout():
def xtest_timeout():
"""
Test command_runner with a timeout
"""
Expand All @@ -151,7 +155,7 @@ def test_timeout():
assert 'Timeout' in output, 'Output should have timeout with method {}'.format(method)


def test_timeout_with_subtree_killing():
def xtest_timeout_with_subtree_killing():
"""
Launch a subtree of long commands and see if timeout actually kills them in time
"""
Expand All @@ -171,7 +175,7 @@ def test_timeout_with_subtree_killing():
assert 'Timeout' in output, 'Output should have timeout with method {}'.format(method)


def test_no_timeout():
def xtest_no_timeout():
"""
Test with setting timeout=None
"""
Expand All @@ -181,7 +185,7 @@ def test_no_timeout():
assert exit_code == 0, 'Without timeout, command should have run with method {}'.format(method)


def test_live_output():
def xtest_live_output():
"""
Test command_runner with live output to stdout
"""
Expand All @@ -190,7 +194,7 @@ def test_live_output():
assert exit_code == 0, 'Exit code should be 0 for ping command with method {}'.format(method)


def test_not_found():
def xtest_not_found():
"""
Test command_runner with an unexisting command
"""
Expand All @@ -201,7 +205,7 @@ def test_not_found():
assert "failed" in output, 'Error code -253 should be Command x failed, reason'


def test_file_output():
def xtest_file_output():
"""
Test command_runner with file output instead of stdout
"""
Expand Down Expand Up @@ -230,7 +234,7 @@ def test_file_output():
os.remove(stderr_filename)


def test_valid_exit_codes():
def xtest_valid_exit_codes():
"""
Test command_runner with a failed ping but that should not trigger an error
Expand All @@ -251,7 +255,7 @@ def test_valid_exit_codes():



def test_unix_only_split_command():
def xtest_unix_only_split_command():
"""
This test is specifically written when command_runner receives a str command instead of a list on unix
"""
Expand All @@ -261,7 +265,7 @@ def test_unix_only_split_command():
assert exit_code == 0, 'Non splitted command should not trigger an error with method {}'.format(method)


def test_create_no_window():
def xtest_create_no_window():
"""
Only used on windows, when we don't want to create a cmd visible windows
"""
Expand All @@ -270,7 +274,7 @@ def test_create_no_window():
assert exit_code == 0, 'Should have worked too with method {}'.format(method)


def test_read_file():
def xtest_read_file():
"""
Read a couple of times the same file to be sure we don't get garbage from _read_pipe()
This is a random failure detection test
Expand All @@ -283,7 +287,6 @@ def test_read_file():
else:
with open(TEST_FILENAME, 'r', encoding=ENCODING) as file:
file_content = file.read()

for method in methods:
# pypy is quite slow with poller method on github actions.
# Lets lower rounds
Expand All @@ -299,7 +302,7 @@ def test_read_file():
assert file_content == output, 'Round {} File content and output are not identical, method={}'.format(round, method)


def test_stop_on_argument():
def xtest_stop_on_argument():
expected_output_regex = "Command .* was stopped because stop_on function returned True. Original output was:"
def stop_on():
"""
Expand All @@ -326,7 +329,7 @@ def stop_on():
output)


def test_process_callback():
def xtest_process_callback():
def callback(process_id):
global PROCESS_ID
PROCESS_ID = process_id
Expand All @@ -338,7 +341,7 @@ def callback(process_id):
assert isinstance(PROCESS_ID, subprocess.Popen), 'callback did not work properly. PROCESS_ID="{}"'.format(PROCESS_ID)


def test_stream_callback():
def xtest_stream_callback():
global STREAM_OUTPUT

def stream_callback(string):
Expand Down Expand Up @@ -367,7 +370,7 @@ def stream_callback(string):
output)


def test_queue_output():
def xtest_queue_output():
"""
Thread command runner and get it's output queue
"""
Expand Down Expand Up @@ -417,7 +420,7 @@ def test_queue_output():
output)


def test_queue_non_threaded_command_runner():
def xtest_queue_non_threaded_command_runner():
"""
Test case for Python 2.7 without proper threading return values
"""
Expand Down Expand Up @@ -470,7 +473,7 @@ def read_queue(output_queue, stream_output):
assert stream_output['value'] == output, 'Output should be identical'


def test_double_queue_threaded_stop():
def xtest_double_queue_threaded_stop():
"""
Use both stdout and stderr queues and make them stop
"""
Expand Down Expand Up @@ -521,7 +524,7 @@ def test_double_queue_threaded_stop():
assert exit_code == 0, 'We did not succeed in running the thread'


def test_deferred_command():
def xtest_deferred_command():
"""
Using deferred_command in order to run a command after a given timespan
"""
Expand All @@ -535,7 +538,7 @@ def test_deferred_command():
os.remove(test_filename)


def test_powershell_output():
def xtest_powershell_output():
# Don't bother to test powershell on other platforms than windows
if os.name != 'nt':
return
Expand Down Expand Up @@ -585,7 +588,7 @@ def test_powershell_output():
assert exit_code == 0, 'Powershell execution failed.'


def test_null_redir():
def xtest_null_redir():
for method in methods:
print('method={}'.format(method))
exit_code, output = command_runner(PING_CMD, stdout=False)
Expand Down Expand Up @@ -618,7 +621,7 @@ def test_null_redir():
assert stderr is None, 'We should not have any output from stderr'


def test_split_streams():
def xtest_split_streams():
"""
Test replacing output with stdout and stderr output
"""
Expand Down Expand Up @@ -647,7 +650,7 @@ def test_split_streams():
assert '127.0.0.1' in stdout
assert '0.0.0.0' in stderr

def test_on_exit():
def xtest_on_exit():
def on_exit():
global ON_EXIT_CALLED
ON_EXIT_CALLED = True
Expand All @@ -657,7 +660,7 @@ def on_exit():
assert ON_EXIT_CALLED is True, 'On exit was never called'


def test_priority():
def xtest_priority():
def check_nice(process):
niceness = os.nice(process.pid)
if os.name == 'nt':
Expand All @@ -677,7 +680,7 @@ def command_runner_thread():
thread.start()


def test_no_close_queues():
def xtest_no_close_queues():
"""
Test no_close_queues
"""
Expand Down

0 comments on commit c8421bb

Please sign in to comment.