jetbrains-academy / introduction_to_python

Introduction to Python course
MIT License
42 stars 27 forks source link

Introduction / Comments #143

Closed edutools-service closed 1 year ago

edutools-service commented 1 year ago

When I am clicking the option "CHECK' in task window it is showing "Incorect" everytime. But I did everything what the task instructed me to do. /usr/bin/python3.10 /home/sridip/pycharm-community-2022.3/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py --path /home/sridip/PycharmProjects/Introduction to Python/Introduction/Comments/tests/test_task.py Testing started at 10:11 pm ... Launching pytest with arguments /home/sridip/PycharmProjects/Introduction to Python/Introduction/Comments/tests/test_task.py --no-header --no-summary -q in /home/sridip/PycharmProjects/Introduction to Python/Introduction/Comments

============================= test session starts ============================== collecting ... collected 2 items

tests/test_task.py::TestCase::test_assignment_operator FAILED [ 50%] tests/test_task.py:28 (TestCase.test_assignment_operator) self =

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
              importlib.import_module(self.task_name)

tests/test_task.py:24:


name = 'comments', package = None

def import_module(name, package=None):
    """Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    """
    level = 0
    if name.startswith('.'):
        if not package:
            msg = ("the 'package' argument is required to perform a relative "
                   "import for {!r}")
            raise TypeError(msg.format(name))
        for character in name:
            if character != '.':
                break
            level += 1
  return _bootstrap._gcd_import(name[level:], package, level)

/usr/lib/python3.10/importlib/init.py:126:


name = 'comments', package = None, level = 0

???

:1050: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'comments', import_ = > ??? :1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'comments', import_ = > ??? E ModuleNotFoundError: No module named 'comments' :1004: ModuleNotFoundError During handling of the above exception, another exception occurred: self = def setUp(self): try: # Stores output from print() in actualOutput with patch('sys.stdout', new=StringIO()) as self.actualOutput: # Loads submission on first test, reloads on subsequent tests if self.task_name in sys.modules: importlib.reload(sys.modules[self.task_name]) else: importlib.import_module(self.task_name) except Exception as e: > self.fail("There was a problem while loading the solution – {0}. Check the solution for IDE-highlighted " "errors and warnings.".format(str(e))) E AssertionError: There was a problem while loading the solution – No module named 'comments'. Check the solution for IDE-highlighted errors and warnings. tests/test_task.py:26: AssertionError FAILED [100%] tests/test_task.py:35 (TestCase.test_output_len) self = def setUp(self): try: # Stores output from print() in actualOutput with patch('sys.stdout', new=StringIO()) as self.actualOutput: # Loads submission on first test, reloads on subsequent tests if self.task_name in sys.modules: importlib.reload(sys.modules[self.task_name]) else: > importlib.import_module(self.task_name) tests/test_task.py:24: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'comments', package = None def import_module(name, package=None): """Import a module. The 'package' argument is required when performing a relative import. It specifies the package to use as the anchor point from which to resolve the relative import to an absolute import. """ level = 0 if name.startswith('.'): if not package: msg = ("the 'package' argument is required to perform a relative " "import for {!r}") raise TypeError(msg.format(name)) for character in name: if character != '.': break level += 1 > return _bootstrap._gcd_import(name[level:], package, level) /usr/lib/python3.10/importlib/__init__.py:126: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'comments', package = None, level = 0 > ??? :1050: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'comments', import_ = > ??? :1027: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'comments', import_ = > ??? E ModuleNotFoundError: No module named 'comments' :1004: ModuleNotFoundError During handling of the above exception, another exception occurred: self = def setUp(self): try: # Stores output from print() in actualOutput with patch('sys.stdout', new=StringIO()) as self.actualOutput: # Loads submission on first test, reloads on subsequent tests if self.task_name in sys.modules: importlib.reload(sys.modules[self.task_name]) else: importlib.import_module(self.task_name) except Exception as e: > self.fail("There was a problem while loading the solution – {0}. Check the solution for IDE-highlighted " "errors and warnings.".format(str(e))) E AssertionError: There was a problem while loading the solution – No module named 'comments'. Check the solution for IDE-highlighted errors and warnings. tests/test_task.py:26: AssertionError tests/test_task.py::TestCase::test_output_len ============================== 2 failed in 0.07s =============================== Process finished with exit code 1
sofiiako commented 1 year ago

Hi! Could you please try checking if you have a correct Python interpreter in the project settings? If not, please configure it: PyCharm; IDEA. Try reloading the project and checking tasks again. If you continue experiencing the issue, please send us full logs from Help->Show Log in Explorer/Finder. Please also include the IDE version, EduTools plugin version, and OS. Thank you!