簡體   English   中英

在PyCharm / IntelliJ IDEA12中的python模塊中運行unittest?

[英]Run unittest in a python module in PyCharm/IntelliJ IDEA12?

testsuite/__init__.py ,我這樣寫:

import unittest
def suite():
    from my_module.testsuite import (
    shell_command,
    shell_command_on_jinja,
    workflow
    )
    suite = unittest.TestSuite()
    suite.addTest(shell_command.suite())
    suite.addTest(shell_command_on_jinja.suite())
    suite.addTest(workflow.suite())

    return suite

在終端中,我可以像這樣執行測試套件:

python3 -m unittest testsuite.suite

但是,我不知道如何為Pycharm / InteliJ配置測試。 我在Python's test下添加了一個配置,並將Test設置為Function ,將Scriptmy_module/testsuite/__init__.py ,並將Functionsuite ,然后運行它。 但這是行不通的。 有人對此有想法嗎? 謝謝!

似乎PyCharm現在不支持此功能。 請檢查以下線程。

http://forum.jetbrains.com/thread/PyCharm-1116

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM