Pycharm won't allow to run a file. Shows run unittest option only.

前端 未结 6 1513
猫巷女王i
猫巷女王i 2020-12-28 12:41

I have a file and it has bunch of methods starting with prefix \"test\". Now I want to run this file and it has a __name__ == \"__main__\" construct which sets

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-28 12:58

    Using PyCharm Community Edition 2017.2 EAP. Here is how I did it:

    1. From the Run menu select Run.... (Or use its keyboard shortcut)
    2. A popup menu appears that should contain at least three entries: edit configuration..., my_script_name, and Unittests in my_script_name.py. Click on the right arrow of my_script_name.
    3. If the configuration is not saved, you should be able to see a save configuration option in the arrow menu. Choose it.

    If the configuration changed again, follow the same steps but this time choose run in the last step.

提交回复
热议问题