TESTed judge give "Memory limit exceeded" #5234
-
I've just started using TESTed in my evaluation for an Python excercise. I try to test a function that is used in a main script but I get a "Memory limit exceeded" error. I've extended the memory setting to 200K but still the same issue. The test takes very long before I get the error. The same excercise with only the function get tested well with TESTed judge and the same tests.yaml file. Excercise with the "pythia_judge": "output" that only test the main script (works well): https://dodona.be/nl/activities/1523415852/ Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
The problem lies in the solution for the excercise with the main script and function, specifically line 26 and later: while teller <=3:
try:
score_notitie_worp = input(f"Geef de score van je {teller}e worp in volgens de scorenotitie: ") Since this is top-level code, it will always be executed, even if the test suite only has a function call (as Python will always execute top level code when a file is imported). A solution is to move the top-level code under What happens now is the following:
This basically results in an infinite loop, where the a piece of text is printed each time, which causes the memory limit exceeded status. If there were no memory limit, you would run into time limit exceeded. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your quick response! Now I can test the function but I want to test de top-level-code as well so I've added a input/output test (see https://dodona.be/nl/activities/220810910/) but the test fails because there is no output where I have a print()... I can't see why the output isn't there in the test. ... Any idee why that is the case? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
-
Thanks for another quick response. PS. in discussion #4971 I had already mentioned this requirement (testing top-level code and functions together) and I was directed to TESTed as solution. Thanks again. |
Beta Was this translation helpful? Give feedback.
The problem lies in the solution for the excercise with the main script and function, specifically line 26 and later:
Since this is top-level code, it will always be executed, even if the test suite only has a function call (as Python will always execute top level code when a file is imported). A solution is to move the top-level code under
if __name__ == '__main__':
.What happens now is the following:
stdin
.stdin
in this exercise, so it throws a