Skip to content

Commit

Permalink
replace "python" with "sys.executable" (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Python-in-China committed Dec 15, 2024
1 parent 49a998e commit 9d62d32
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[MASTER]
py-version=3.5
py-version=3.6
disable=R0902,R0903,R0913,R0917,R0912
10 changes: 5 additions & 5 deletions cyaron/tests/compare_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ def test_fulltext_program(self):

try:
with captured_output() as (out, err):
Compare.program("python correct.py",
"python incorrect.py",
Compare.program(f"{sys.executable} correct.py",
f"{sys.executable} incorrect.py",
std=io,
input=io,
grader="FullText")
except CompareMismatch as e:
self.assertEqual(e.name, 'python incorrect.py')
self.assertEqual(e.name, f"{sys.executable} incorrect.py")
e = e.mismatch
self.assertEqual(e.content, '2\n')
self.assertEqual(e.std, '1\n')
Expand Down Expand Up @@ -120,8 +120,8 @@ def test_file_input(self):
io.input_writeln("233")

with captured_output() as (out, err):
Compare.program("python correct.py",
std_program="python std.py",
Compare.program(f"{sys.executable} correct.py",
std_program=f"{sys.executable} std.py",
input=io,
grader="NOIPStyle")

Expand Down
11 changes: 7 additions & 4 deletions cyaron/tests/io_test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import unittest
import os
import shutil
import tempfile
import subprocess
import sys
import tempfile
import unittest
from cyaron import IO
from cyaron.output_capture import captured_output

Expand Down Expand Up @@ -80,7 +81,8 @@ def test_output_gen_time_limit_exceeded(self):

try:
with IO("test_gen.in", "test_gen.out") as test:
test.output_gen("python long_time.py", time_limit=1)
test.output_gen(f"{sys.executable} long_time.py",
time_limit=1)
except subprocess.TimeoutExpired:
time_limit_exceeded = True
self.assertEqual(time_limit_exceeded, True)
Expand All @@ -93,7 +95,8 @@ def test_output_gen_time_limit_not_exceeded(self):

try:
with IO("test_gen.in", "test_gen.out") as test:
test.output_gen("python short_time.py", time_limit=1)
test.output_gen(f"{sys.executable} short_time.py",
time_limit=1)
except subprocess.TimeoutExpired:
time_limit_exceeded = True
with open("test_gen.out") as f:
Expand Down

0 comments on commit 9d62d32

Please sign in to comment.