2014-05-05 77 views
3

我爲Python代碼編寫了測試套裝。我沒有設法配置Pycharm來識別這個測試套件。當與鼻試運行它,我得到的Pycharm控制檯以下消息:Runnig使用Pycharm進行測試並獲得「空測試套件」

Empty test suite 

下面是完整的日誌:

Testing started at 2:12 PM ... 

nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$'] 
nose.plugins.manager: DEBUG: Configuring plugins 
nose.plugins.manager: DEBUG: Plugins enabled: [<nose_utils.TeamcityPlugin run=0  errors=0 failures=0>, <nose_unittest.plugin.UnitTestPlugin object at 0x1a4fcd0>, <nose.plugins.logcapture.LogCapture object at 0x1a57c90>, <nose.plugins.deprecated.Deprecated object at 0x1a5ab90>, <nose.plugins.skip.Skip object at 0x1c07a10>, <nose.plugins.xunit.Xunit object at 0x1c07b10>] 
nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$'] 
nose.plugins.manager: DEBUG: Configuring plugins 
nose.plugins.manager: DEBUG: Plugins enabled: [<nose_unittest.plugin.UnitTestPlugin object at 0x1a4fcd0>, <nose.plugins.xunit.Xunit object at 0x1c07b10>, <nose_utils.TeamcityPlugin run=0 errors=0 failures=0>, <nose.plugins.deprecated.Deprecated object at 0x1a5ab90>, <nose.plugins.skip.Skip object at 0x1c07a10>, <nose.plugins.logcapture.LogCapture object at 0x1a57c90>] 
nose.core: DEBUG: configured Config(addPaths=True, args=(), configSection='nosetests', debug=None, debugLog=None, env={}, exclude=None, firstPackageWins=False, getTestCaseNamesCompat=False, ignoreFiles=[<_sre.SRE_Pattern object at 0x1a483b0>, <_sre.SRE_Pattern object at 0x1a482b0>, <_sre.SRE_Pattern object at 0x1a40270>], ignoreFilesDefaultStrings=['^\\.', '^_', '^setup\\.py$'], include=None, includeExe=False, logStream=<open file '<stderr>', mode 'w' at 0x7f9587bba1e0>, loggingConfig=None, options=<Values at 0x1c65560: {'xunit_file': 'nosetests.xml', 'enable_plugin_allmodules': None, 'multiprocess_restartworker': False, 'testconfigencoding': 'utf-8', 'loggingConfig': None, 'doctestExtension': None, 'doctest_tests': None, 'enable_plugin_unittest': None, 'testconfig': None, 'debugBoth': False, 'logcapture_clear': False, 'stopOnError': False, 'enable_plugin_id': None, 'testNames': None, 'doctestOptions': None, 'exclude': [], 'byteCompile': True, 'ignoreFiles': [], 'logcapture': True, 'addPaths': True, 'capture': False, 'logcapture_level': 'NOTSET', 'cover_xml': None, 'py3where': None, 'noSkip': False, 'enable_plugin_isolation': None, 'logcapture_filters': None, 'collect_only': None, 'failed': False, 'enable_plugin_TeamcityPlugin': None, 'eval_attr': None, 'version': False, 'overrides': [], 'include': [], 'enable_plugin_profile': None, 'debugErrors': False, 'files': None, 'cover_tests': None, 'multiprocess_timeout': 10, 'testMatch': '(?:^|[\\b_\\./-])[Tt]est', 'traverseNamespace': False, 'testconfigformat': 'ini', 'firstPackageWins': False, 'cover_html_dir': 'cover', 'cover_branches': None, 'enable_plugin_xunit': True, 'noDeprecated': False, 'cover_xml_file': 'coverage.xml', 'showPlugins': False, 'cover_erase': None, 'multiprocess_workers': 0, 'exact': False, 'testIdFile': '.noseids', 'enable_plugin_coverage': None, 'attr': None, 'profile_sort': 'cumulative', 'doctestFixtures': None, 'logcapture_datefmt': None, 'cover_packages': None, 'profile_restrict': None, 'enable_plugin_doctest': None, 'profile_stats_file': None, 'cover_inclusive': None, 'includeExe': False, 'logcapture_format': '%(name)s: %(levelname)s: %(message)s', 'debugFailures': False, 'detailedErrors': None, 'debugLog': None, 'doctest_result_var': None, 'cover_html': None, 'debug': None, 'cover_min_percentage': None, 'where': None, 'verbosity': 4}>, parser=<optparse.OptionParser instance at 0x1a497e8>, parserClass=<class optparse.OptionParser at 0x7f9586056808>, plugins=<nose.plugins.manager.DefaultPluginManager object at 0x1a47510>, py3where=(), runOnInit=True, srcDirs=('lib', 'src'), stopOnError=False, stream=<open file '<stderr>', mode 'w' at 0x7f9587bba1e0>, testMatch=<_sre.SRE_Pattern object at 0x19e8330>, testMatchPat='(?:^|[\\b_\\./-])[Tt]est', testNames=['/home/faina/seculert/seculert/trunk/pymodules/seculert/integration_tests/sense/testSenseE2E.py'], traverseNamespace=False, verbosity=4, where=(), worker=False, workingDir='/home/faina/seculert/seculert/trunk/pymodules/seculert/integration_tests/sense') 
nose.importer: DEBUG: Add path /home/trunk/pymodules/integration_tests/x 
nose.importer: DEBUG: Add path /home/trunk/pymodules/integration_tests 
nose.importer: DEBUG: Add path /home/trunk/pymodules 
nose.core: DEBUG: test loader is <nose.loader.TestLoader object at 0x1c07fd0> 
nose.core: DEBUG: defaultTest . 
nose.core: DEBUG: Test names are ['/home/trunk/pymodules/integration_tests/x/testx.py'] 
nose.core: DEBUG: createTests called with None 
nose.loader: DEBUG: load from /home/trunk/pymodules/integration_tests/x/testx.py (None) 
nose.selector: DEBUG: Test name /home/trunk/pymodules/integration_tests/x/testx.py resolved to file /home/trunk/pymodules/integration_tests/x/testx.py, module None, call None 
nose.selector: DEBUG: Final resolution of test name /home/trunk/pymodules/integration_tests/sense/testSenseE2E.py: file /home/trunk/pymodules/integration_tests/x/testx.py module integration_tests.x.testx call None 
nose.importer: DEBUG: Import integration_tests.x.testx from /home/trunk/pymodules 
nose.importer: DEBUG: Add path /home/trunk/pymodules 
nose.importer: DEBUG: find module part x (x) in ['/home/trunk/pymodules'] 
nose.importer: DEBUG: find module part integration_tests (integration_tests) in ['/home/trunk/pymodules'] 
nose.importer: DEBUG: find module part x (integration_tests.x) in ['/home/trunk/pymodules/integration_tests'] 
nose.importer: DEBUG: find module part testx (integration_tests.x.testx) in ['/home/trunk/pymodules/integration_tests/x'] 
nose.loader: DEBUG: Load from module <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> 
nose.selector: DEBUG: Plugin setting selection of managers.bashManager.BashManager to False 
nose.selector: DEBUG: wantClass managers.bashManager.BashManager? False 
nose.suite: DEBUG: Create suite for <nose.suite.ContextList object at 0x2315790> 
nose.suite: DEBUG: tests <nose.suite.ContextList object at 0x2315790> context <module 'integration_tests.sense.testSenseE2E' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> 
nose.suite: DEBUG: Context suite for <nose.suite.ContextList object at 0x2315790> (<module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'>) (36788176) 
nose.suite: DEBUG: suite <nose.suite.ContextSuite context=integration_tests.x.testx> has context integration_tests.x.testx 
nose.suite: DEBUG: get ancestry <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> 
nose.suite: DEBUG: <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> ancestors ['integration_tests', 'x'] 
nose: DEBUG: __import__ integration_tests.x 
nose: DEBUG: resolve: ['integration_tests', 'x'], integration_tests.x, <module 'x' from '/home/trunk/pymodules/__init__.pyc'>, <module 'x' from '/home/trunk/pymodules/__init__.pyc'> 
nose.suite: DEBUG: suite <nose.suite.ContextSuite context=integration_tests.x.testx> has ancestor integration_tests.sense 
nose.suite: DEBUG: <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> ancestors [ 'integration_tests'] 
nose: DEBUG: __import__ integration_tests 
nose: DEBUG: resolve: ['integration_tests'], integration_tests, <module 'x' from '/home/trunk/pymodules/__init__.pyc'>, <module 'x' from '/home/trunk/pymodules/__init__.pyc'> 
nose.suite: DEBUG: suite <nose.suite.ContextSuite context=integration_tests.x.testx> has ancestor integration_tests 
nose.suite: DEBUG: <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> ancestors ['x'] 
nose: DEBUG: __import__ x 
nose: DEBUG: resolve: [], x, <module 'x' from '/home/pymodules/__init__.pyc'>, <module 'x' from '/home/trunk/pymodules/__init__.pyc'> 
nose.suite: DEBUG: suite <nose.suite.ContextSuite context=integration_tests.sense.testx> has ancestor x 
nose.suite: DEBUG: Create suite for [<nose.suite.ContextSuite context=integration_tests.x.testx>] 
nose.suite: DEBUG: tests [<nose.suite.ContextSuite context=integration_tests.x.testx>] context None 
nose.suite: DEBUG: wrap [<nose.suite.ContextSuite context=integration_tests.x.testx>] 
nose.suite: DEBUG: wrapping <nose.suite.ContextSuite context=integration_tests.x.testx> 
nose.suite: DEBUG: Context suite for [<nose.suite.ContextSuite context=integration_tests.x.testx>] (<module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'>) (29782416) 
nose.suite: DEBUG: suite <nose.suite.ContextSuite context=integration_tests.x.testx> has context integration_tests.x.testx 
nose.suite: DEBUG: get ancestry <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> 
nose.suite: DEBUG: <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> ancestors ['x', 'integration_tests'] 
nose: DEBUG: __import__ integration_tests 
nose: DEBUG: resolve: ['integration_tests'], integration_tests, <module 'x' from '/home/trunk/pymodules/__init__.pyc'>, <module 'x' from '/home/trunk/pymodules/__init__.pyc'> 
nose.suite: DEBUG: suite <nose.suite.ContextSuite context=integration_tests.x.testx> has ancestor integration_tests 
nose.suite: DEBUG: <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> ancestors ['x'] 
nose.core: DEBUG: runTests called 
nose.suite: DEBUG: suite 29782416 (<nose.suite.ContextSuite context=integration_tests.x.testx>) run called, tests: <generator object _get_wrapped_tests at 0x240f1e0> 
nose.suite: DEBUG: suite 29782416 setUp called, tests: <generator object _get_wrapped_tests at 0x240f410> 
nose.suite: DEBUG: tests in 29782416? 
nose.suite: DEBUG: ancestor <module 'seculert' from '/home/trunk/pymodules/__init__.pyc'> may need setup 
nose.suite: DEBUG: ancestor <module 'seculert' from '/home/trunk/pymodules/__init__.pyc'> does need setup 
nose.suite: DEBUG: <nose.suite.ContextSuite context=integration_tests.x.testx> setup context <module 'x' from '/home/trunk/pymodules/__init__.pyc'> 
nose.suite: DEBUG: ancestor <module 'integration_tests' from '/home/trunk/pymodules/integration_tests/__init__.pyc'> may need setup 
nose.suite: DEBUG: ancestor <module 'integration_tests' from '/home/trunk/pymodules/integration_tests/__init__.pyc'> does need setup 
nose.suite: DEBUG: <nose.suite.ContextSuite context=integration_tests.x.testx> setup context <module 'integration_tests' from '/home/trunk/pymodules/integration_tests/__init__.pyc'> 
nose.suite: DEBUG: ancestor <module 'integration_tests.x' from '/home/trunk/pymodules/integration_tests/x/__init__.pyc'> may need setup 
nose.suite: DEBUG: ancestor <module 'integration_tests.x' from '/home/trunk/pymodules/integration_tests/x/__init__.pyc'> does need setup 
nose.suite: DEBUG: <nose.suite.ContextSuite context=integration_tests.x.testx> setup context <module 'integration_tests.x' from '/home/trunk/pymodules/integration_tests/x/__init__.pyc'> 
nose.suite: DEBUG: ancestor <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> may need setup 
nose.suite: DEBUG: ancestor <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> does need setup 
nose.suite: DEBUG: <nose.suite.ContextSuite context=integration_tests.x.testx> setup context <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> 
nose.suite: DEBUG: completed suite setup 
nose.suite: DEBUG: precache is [<nose.suite.ContextSuite context=integration_tests.x.testx>] 
nose.suite: DEBUG: suite 36788176 (<nose.suite.ContextSuite context=integration_tests.x.testx>) run called, tests: <generator object _get_wrapped_tests at 0x240f550> 
nose.suite: DEBUG: suite 36788176 setUp called, tests: <generator object _get_wrapped_tests at 0x240f550> 
nose.suite: DEBUG: tests in 36788176? 
nose.suite: DEBUG: suite 36788176 has no tests 
nose.suite: DEBUG: precache is [] 
nose.suite: DEBUG: context teardown 
nose.suite: DEBUG: No reason to teardown (was_setup? False was_torndown? False) 
nose.suite: DEBUG: context teardown 
nose.suite: DEBUG: ancestor <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> may need teardown 
nose.suite: DEBUG: ancestor <module 'integration_tests.x.testx' from '/home/trunk/pymodules/integration_tests/x/testx.pyc'> already torn down 

---------------------------------------------------------------------- 
XML: nosetests.xml 
---------------------------------------------------------------------- 
Ran 0 tests in 0.002s 

OK 

進程退出代碼爲0 空測試套件完成。

+0

你能發現pyCharm以外的測試嗎? – Oleksiy

+0

我想試試。我怎麼能這樣做?我應該從命令行運行測試嗎? – sunny

+0

只需在您進行測試的文件夾中運行「nosetests」。此外,您的測試代碼片段的例子也很有用。 – Oleksiy

回答

1

正如here所提到的,「默認測試運行器」必須在文件>設置>工具> Python集成工具對話框中設置爲鼻測試。但是,如果您已嘗試使用非Nosetests跑步者跑步(,例如 Unittests似乎是默認跑步者),那麼您必須先刪除現有的配置。要做到這一點,請轉到Run> Edit Configurations,在「Python測試」下看到它會顯示「Unit test in your test_your_filename」。點擊它,然後點擊框架頂部的紅色' - '按鈕進行刪除。