Unable to run unit tests in PyCharm
已回答
I am trying to run a simple unit test in PyCharm, but getting the following error while running the test case:
```
class com.jetbrains.python.testing.PyTestConfiguration cannot be cast to class com.jetbrains.python.run.PythonRunConfiguration (com.jetbrains.python.testing.PyTestConfiguration and com.jetbrains.python.run.PythonRunConfiguration are in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @64baed99)
```
My test file is very basic:
from unittest import TestCase
from main import print_hi
class Test(TestCase):
def test_print_hi(self):
assert print_hi("name") == "name"
This error is happening for every pycharm project in my M1 MacBook Pro. I can run the test case from my terminal, though.
My PyCharm version is: PyCharm 2022.2.2 (Professional Edition)
Let me know if any further details will be required from my side.
请先登录再写评论。
This is the issue with the Better Direnv plugin https://plugins.jetbrains.com/plugin/19275-better-direnv
Uninstalling the plugin should help.
Thanks Sergey Karpov, it worked after disabling the plugin.