diff --git a/SprintLib/testers/BaseTester.py b/SprintLib/testers/BaseTester.py index 6e2bfd8..849e0d5 100644 --- a/SprintLib/testers/BaseTester.py +++ b/SprintLib/testers/BaseTester.py @@ -31,10 +31,11 @@ class BaseTester: raise TestException("CE") def test(self, filename): - code = self.solution.exec_command( - f"< {filename} {self.command} > output.txt", - timeout=self.solution.task.time_limit / 1000, - ) + with Timer(self.solution, filename): + code = self.solution.exec_command( + f"< {filename} {self.command} > output.txt", + timeout=self.solution.task.time_limit / 1000, + ) if code != 0: raise TestException("RE") result = open(join(self.solution.testing_directory, "output.txt"), "r").read().strip().replace('\r\n', '\n') @@ -123,8 +124,7 @@ class BaseTester: self.solution.extras[test.filename] = {'predicted': test.text, 'output': ''} self.solution.save() try: - with Timer(self.solution, test.filename) as timer: - self.test(test.filename) + self.test(test.filename) finally: if exists(join(self.path, "output.txt")): try: diff --git a/templates/solution.html b/templates/solution.html index a2b06a5..c28842f 100644 --- a/templates/solution.html +++ b/templates/solution.html @@ -45,4 +45,22 @@
{{ entity.text }}

{% endfor %} + + {% if solution.task.creator == user or user.username in solution.task.editors or solution.set and solution.set.creator == user or solution.set and user.username in solution.set.editors %} +

Лог тестрования

+ {% for key, value in solution.extras.items %} +
{{ key }}
+ Затраченное время: {{ value.time_spent }} мс +
+
+
+ {{ value.predicted }} +
+
+
+ {{ value.output }} +
+
+ {% endfor %} + {% endif %} {% endblock %} \ No newline at end of file