2
2
import shutil
3
3
import tempfile
4
4
5
- from lms .lmsdb import models
5
+ from lms .lmsdb . models import Comment , Solution
6
6
from lms .lmstests .public .linters import tasks
7
7
from lms .models import notifications
8
8
@@ -30,23 +30,23 @@ def teardown_class(cls):
30
30
if cls .test_directory is not None :
31
31
shutil .rmtree (cls .test_directory )
32
32
33
- def test_pyflake_wont_execute_code (self , solution : models . Solution ):
33
+ def test_pyflake_wont_execute_code (self , solution : Solution ):
34
34
solution_file = solution .solution_files .get ()
35
35
solution_file .code = self .execute_script
36
36
solution_file .save ()
37
37
tasks .run_linter_on_solution (solution .id )
38
- comments = tuple (models . Comment .by_solution (solution ))
38
+ comments = tuple (Comment .by_solution (solution ))
39
39
assert not os .listdir (self .test_directory )
40
40
assert len (comments ) == 2
41
41
exec (compile (self .execute_script , '' , 'exec' )) # noqa S102
42
42
assert os .listdir (self .test_directory ) == ['some-file' ]
43
43
44
- def test_invalid_solution (self , solution : models . Solution ):
44
+ def test_invalid_solution (self , solution : Solution ):
45
45
solution_file = solution .solution_files .get ()
46
46
solution_file .code = INVALID_CODE
47
47
solution_file .save ()
48
48
tasks .run_linter_on_solution (solution .id )
49
- comments = tuple (models . Comment .by_solution (solution ))
49
+ comments = tuple (Comment .by_solution (solution ))
50
50
assert comments
51
51
assert len (comments ) == 1
52
52
comment = comments [0 ].comment
@@ -59,10 +59,10 @@ def test_invalid_solution(self, solution: models.Solution):
59
59
assert solution .exercise .subject in subject
60
60
assert '1' in subject
61
61
62
- def test_valid_solution (self , solution : models . Solution ):
62
+ def test_valid_solution (self , solution : Solution ):
63
63
solution_file = solution .solution_files .get ()
64
64
solution_file .code = VALID_CODE
65
65
solution_file .save ()
66
66
tasks .run_linter_on_solution (solution .id )
67
- comments = tuple (models . Comment .by_solution (solution ))
67
+ comments = tuple (Comment .by_solution (solution ))
68
68
assert not comments
0 commit comments