Skip to content

Commit

Permalink
make all existing checks independent and use decorator, fix assignmen…
Browse files Browse the repository at this point in the history
…t checking, make error messages better and more uniform, add functioning sanity tests
  • Loading branch information
kaareloide committed Mar 19, 2020
1 parent 8a4686b commit 3ebc398
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/assignment_tests/assignment_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
from ..test_utils import run_test_scenario
from temp.test_utils import run_test_scenario
from messages import get_formatted_message


Expand Down
2 changes: 1 addition & 1 deletion tests/bracket_tests/brackets_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
from ..test_utils import run_test_scenario
from temp.test_utils import run_test_scenario
from messages import get_formatted_message


Expand Down
2 changes: 1 addition & 1 deletion tests/def_tests/def_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
from ..test_utils import run_test_scenario
from temp.test_utils import run_test_scenario
from messages import get_formatted_message


Expand Down
2 changes: 1 addition & 1 deletion tests/indentation_tests/indentation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import unittest

import utils
from ..test_utils import run_test_scenario
from temp.test_utils import run_test_scenario
from messages import get_formatted_message


Expand Down
2 changes: 1 addition & 1 deletion tests/quotes_test/quotes_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
from ..test_utils import run_test_scenario
from temp.test_utils import run_test_scenario
from messages import get_formatted_message


Expand Down
2 changes: 1 addition & 1 deletion tests/sanity_test/sanity_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
from ..test_utils import run_test_scenario
from temp.test_utils import run_test_scenario
from messages import get_formatted_message


Expand Down
8 changes: 4 additions & 4 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest import TestCase
from typing import NoReturn, List, Union

from check_runner import run_checks
from utils import find_errors_and_get_simple_messages


Expand All @@ -14,7 +15,7 @@ def run_test_scenario(test_case: TestCase, path: str, expected_messages_count: i
:param expected_messages: 1 or more expected messages can be string or list
:return:
"""
messages = find_errors_and_get_simple_messages(path)
messages = run_checks(path)

# Errors found must equal expected error count
test_case.assertEqual(len(messages), expected_messages_count)
Expand All @@ -23,7 +24,6 @@ def run_test_scenario(test_case: TestCase, path: str, expected_messages_count: i
if expected_messages is not None:
if type(expected_messages) == str:
expected_messages = [expected_messages]
only_messages = [message[1] for message in messages]
print(only_messages)
print(messages)
print(expected_messages)
test_case.assertTrue(set(expected_messages) == set(only_messages))
test_case.assertTrue(set(expected_messages) == set(messages))

0 comments on commit 3ebc398

Please sign in to comment.