codestyle
This commit is contained in:
@@ -50,7 +50,7 @@ languages = [
|
||||
file_type="java",
|
||||
logo_url="https://upload.wikimedia.org/wikipedia/ru/thumb/3/39/Java_logo.svg/1200px-Java_logo.svg.png",
|
||||
image="openjdk",
|
||||
highlight="java"
|
||||
highlight="java",
|
||||
),
|
||||
Language(
|
||||
id=4,
|
||||
@@ -59,6 +59,6 @@ languages = [
|
||||
file_type="cs",
|
||||
logo_url="https://cdn.worldvectorlogo.com/logos/c--4.svg",
|
||||
image="mono",
|
||||
highlight="csharp"
|
||||
)
|
||||
highlight="csharp",
|
||||
),
|
||||
]
|
||||
|
@@ -9,4 +9,8 @@ def send_testing(solution_id):
|
||||
) as connection:
|
||||
channel = connection.channel()
|
||||
channel.queue_declare(queue="test")
|
||||
channel.basic_publish(exchange="", routing_key="test", body=bytes(str(solution_id), encoding='utf-8'))
|
||||
channel.basic_publish(
|
||||
exchange="",
|
||||
routing_key="test",
|
||||
body=bytes(str(solution_id), encoding="utf-8"),
|
||||
)
|
||||
|
@@ -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):
|
||||
|
@@ -6,7 +6,7 @@ from Sprint import settings
|
||||
def write_bytes(data):
|
||||
url = settings.FS_HOST + ":" + str(settings.FS_PORT) + "/upload_file"
|
||||
print(url)
|
||||
return post(url, data=data).json()['id']
|
||||
return post(url, data=data).json()["id"]
|
||||
|
||||
|
||||
def get_bytes(num):
|
||||
|
Reference in New Issue
Block a user