Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions pass_k.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,23 @@ def adjust_indent(code, new_indent):
@func_set_timeout(60)
def execution_tests(args, data):
project_path = os.path.join(args.source_code_root, data['project_path'])
command = ['python', 'setup.py', 'pytest', '--addopts']

setup_path = os.path.join(project_path, "setup.py")
if os.path.isfile(setup_path):
print(f"Running setup.py in {project_path}...")
result = subprocess.run(
["python", "setup.py", "install"],
cwd=project_path,
capture_output=True,
text=True
)
# print("stdout:\n", result.stdout)
if result.returncode != 0:
print("stderr:\n", result.stderr)
print("setup.py failed!")

command = ['pytest']
# command = ['python', 'setup.py', 'pytest', '--addopts']
for test in data['tests']:
process = subprocess.Popen(command + [test], cwd=project_path, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
try:
Expand All @@ -49,7 +65,7 @@ def execution_tests(args, data):
if return_code != 0:
process.terminate()
process.wait()
return 'Error' # Execution Error
return 'Error'
else:
break
except Exception as e:
Expand Down Expand Up @@ -227,4 +243,4 @@ def test_ground_truth(args):
if args.output_file is None:
test_ground_truth(args)
else:
main(args)
main(args)