codestyle
This commit is contained in:
@@ -63,12 +63,16 @@ class BaseTester:
|
||||
mkdir("solutions")
|
||||
mkdir("solutions/" + str(self.solution.id))
|
||||
for file in SolutionFile.objects.filter(solution=self.solution):
|
||||
dirs = file.path.split('/')
|
||||
dirs = file.path.split("/")
|
||||
for i in range(len(dirs) - 1):
|
||||
name = join(str("solutions/" + self.solution.id), '/'.join(dirs[:i + 1]))
|
||||
name = join(
|
||||
str("solutions/" + self.solution.id), "/".join(dirs[: i + 1])
|
||||
)
|
||||
if not exists(name):
|
||||
mkdir(name)
|
||||
with open(join("solutions/" + str(self.solution.id), file.path), 'wb') as fs:
|
||||
with open(
|
||||
join("solutions/" + str(self.solution.id), file.path), "wb"
|
||||
) as fs:
|
||||
fs.write(get_bytes(file.fs_id))
|
||||
self.solution.result = CONSTS["testing_status"]
|
||||
self.solution.save()
|
||||
@@ -77,7 +81,9 @@ class BaseTester:
|
||||
call(docker_command, shell=True)
|
||||
print("Container created")
|
||||
for file in ExtraFile.objects.filter(task=self.solution.task):
|
||||
with open(join("solutions/" + str(self.solution.id), file.filename), 'wb') as fs:
|
||||
with open(
|
||||
join("solutions/" + str(self.solution.id), file.filename), "wb"
|
||||
) as fs:
|
||||
fs.write(get_bytes(file.fs_id))
|
||||
print("Files copied")
|
||||
try:
|
||||
|
@@ -7,13 +7,17 @@ class JavaTester(BaseTester):
|
||||
_executable = None
|
||||
|
||||
def before_test(self):
|
||||
files = [file for file in listdir(self.solution.testing_directory) if file.endswith('.java')]
|
||||
files = [
|
||||
file
|
||||
for file in listdir(self.solution.testing_directory)
|
||||
if file.endswith(".java")
|
||||
]
|
||||
code = self.solution.exec_command(f"javac {' '.join(files)}")
|
||||
if code != 0:
|
||||
raise TestException('CE')
|
||||
raise TestException("CE")
|
||||
for file in listdir(self.solution.testing_directory):
|
||||
if file.endswith('.class'):
|
||||
self._executable = file.rstrip('.class')
|
||||
if file.endswith(".class"):
|
||||
self._executable = file.rstrip(".class")
|
||||
break
|
||||
if self._executable is None:
|
||||
raise TestException("TE")
|
||||
|
@@ -5,10 +5,16 @@ from SprintLib.testers.BaseTester import BaseTester, TestException
|
||||
|
||||
class KotlinTester(BaseTester):
|
||||
def before_test(self):
|
||||
files = [file for file in listdir(self.solution.testing_directory) if file.endswith('.kt')]
|
||||
code = self.solution.exec_command(f'kotlinc {" ".join(files)} -include-runtime -d solution.jar')
|
||||
files = [
|
||||
file
|
||||
for file in listdir(self.solution.testing_directory)
|
||||
if file.endswith(".kt")
|
||||
]
|
||||
code = self.solution.exec_command(
|
||||
f'kotlinc {" ".join(files)} -include-runtime -d solution.jar'
|
||||
)
|
||||
if code != 0:
|
||||
raise TestException('CE')
|
||||
raise TestException("CE")
|
||||
|
||||
@property
|
||||
def command(self):
|
||||
|
Reference in New Issue
Block a user