当前位置: 首页>>代码示例>>Python>>正文


Python model.UI类代码示例

本文整理汇总了Python中testrepository.ui.model.UI的典型用法代码示例。如果您正苦于以下问题:Python UI类的具体用法?Python UI怎么用?Python UI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_load_returns_0_normally

 def test_load_returns_0_normally(self):
     ui = UI([('subunit', _b(''))])
     cmd = load.load(ui)
     ui.set_command(cmd)
     cmd.repository_factory = memory.RepositoryFactory()
     cmd.repository_factory.initialise(ui.here)
     self.assertEqual(0, cmd.execute())
开发者ID:testing-cabal,项目名称:testrepository,代码行数:7,代码来源:test_load.py

示例2: test_load_new_shows_test_failure_details

 def test_load_new_shows_test_failure_details(self):
     buffer = BytesIO()
     stream = subunit.StreamResultToBytes(buffer)
     stream.status(test_id='foo', test_status='inprogress')
     stream.status(test_id='foo', test_status='fail',
         file_name="traceback", mime_type='text/plain;charset=utf8',
         file_bytes=b'arg\n')
     subunit_bytes = buffer.getvalue()
     ui = UI([('subunit', subunit_bytes)])
     cmd = load.load(ui)
     ui.set_command(cmd)
     cmd.repository_factory = memory.RepositoryFactory()
     cmd.repository_factory.initialise(ui.here)
     self.assertEqual(1, cmd.execute())
     suite = ui.outputs[0][1]
     self.assertEqual([
         ('results', Wildcard),
         ('summary', False, 1, None, Wildcard, None,
          [('id', 0, None), ('failures', 1, None)])],
         ui.outputs)
     result = testtools.StreamSummary()
     result.startTestRun()
     try:
         suite.run(result)
     finally:
         result.stopTestRun()
     self.assertEqual(1, result.testsRun)
     self.assertEqual(1, len(result.errors))
开发者ID:testing-cabal,项目名称:testrepository,代码行数:28,代码来源:test_load.py

示例3: test_load_timed_run

 def test_load_timed_run(self):
     if v2_avail:
         buffer = BytesIO()
         stream = subunit.StreamResultToBytes(buffer)
         time = datetime(2011, 1, 1, 0, 0, 1, tzinfo=iso8601.Utc())
         stream.status(test_id='foo', test_status='inprogress', timestamp=time)
         stream.status(test_id='foo', test_status='success',
             timestamp=time+timedelta(seconds=2))
         timed_bytes = buffer.getvalue()
     else:
         timed_bytes = _b('time: 2011-01-01 00:00:01.000000Z\n'
            'test: foo\n'
            'time: 2011-01-01 00:00:03.000000Z\n'
            'success: foo\n'
            'time: 2011-01-01 00:00:06.000000Z\n')
     ui = UI(
         [('subunit', timed_bytes)])
     cmd = load.load(ui)
     ui.set_command(cmd)
     cmd.repository_factory = memory.RepositoryFactory()
     cmd.repository_factory.initialise(ui.here)
     self.assertEqual(0, cmd.execute())
     # Note that the time here is 2.0, the difference between first and
     # second time: directives. That's because 'load' uses a
     # ThreadsafeForwardingResult (via ConcurrentTestSuite) that suppresses
     # time information not involved in the start or stop of a test.
     self.assertEqual(
         [('summary', True, 1, None, 2.0, None, [('id', 0, None)])],
         ui.outputs[1:])
开发者ID:dstanek,项目名称:testrepository,代码行数:29,代码来源:test_load.py

示例4: get_test_ui_and_cmd2

 def get_test_ui_and_cmd2(self, options=(), args=()):
     self.dirty()
     ui = UI(options=options, args=args)
     ui.here = self.tempdir
     cmd = run.run(ui)
     ui.set_command(cmd)
     return ui, cmd
开发者ID:testing-cabal,项目名称:testrepository,代码行数:7,代码来源:test_testcommand.py

示例5: test_load_quiet_shows_nothing

 def test_load_quiet_shows_nothing(self):
     ui = UI([('subunit', _b(''))], [('quiet', True)])
     cmd = load.load(ui)
     ui.set_command(cmd)
     cmd.repository_factory = memory.RepositoryFactory()
     cmd.repository_factory.initialise(ui.here)
     self.assertEqual(0, cmd.execute())
     self.assertEqual([], ui.outputs)
开发者ID:testing-cabal,项目名称:testrepository,代码行数:8,代码来源:test_load.py

示例6: get_test_ui_and_cmd

 def get_test_ui_and_cmd(self, options=(), args=(), proc_outputs=(),
     proc_results=()):
     self.dirty()
     ui = UI(options=options, args=args, proc_outputs=proc_outputs,
         proc_results=proc_results)
     ui.here = self.tempdir
     cmd = run.run(ui)
     ui.set_command(cmd)
     return ui, cmd
开发者ID:dstanek,项目名称:testrepository,代码行数:9,代码来源:test_run.py

示例7: test_load_initialises_repo_if_doesnt_exist_and_init_forced

 def test_load_initialises_repo_if_doesnt_exist_and_init_forced(self):
     ui = UI([('subunit', _b(''))], options=[('force_init', True)])
     cmd = load.load(ui)
     ui.set_command(cmd)
     calls = []
     cmd.repository_factory = RecordingRepositoryFactory(calls,
         memory.RepositoryFactory())
     del calls[:]
     cmd.execute()
     self.assertEqual([('open', ui.here), ('initialise', ui.here)], calls)
开发者ID:testing-cabal,项目名称:testrepository,代码行数:10,代码来源:test_load.py

示例8: test_TestCommand_get_run_command_outside_setUp_fails

 def test_TestCommand_get_run_command_outside_setUp_fails(self):
     self.dirty()
     ui = UI()
     ui.here = self.tempdir
     command = TestCommand(ui, None)
     self.set_config('[DEFAULT]\ntest_command=foo\n')
     self.assertThat(command.get_run_command, raises(TypeError))
     command.setUp()
     command.cleanUp()
     self.assertThat(command.get_run_command, raises(TypeError))
开发者ID:testing-cabal,项目名称:testrepository,代码行数:10,代码来源:test_testcommand.py

示例9: test_load_new_shows_test_summary_no_tests

 def test_load_new_shows_test_summary_no_tests(self):
     ui = UI([('subunit', _b(''))])
     cmd = load.load(ui)
     ui.set_command(cmd)
     cmd.repository_factory = memory.RepositoryFactory()
     cmd.repository_factory.initialise(ui.here)
     self.assertEqual(0, cmd.execute())
     self.assertEqual(
         [('results', Wildcard),
          ('summary', True, 0, None, None, None, [('id', 0, None)])],
         ui.outputs)
开发者ID:testing-cabal,项目名称:testrepository,代码行数:11,代码来源:test_load.py

示例10: test_partial_passed_to_repo

 def test_partial_passed_to_repo(self):
     ui = UI([('subunit', _b(''))], [('quiet', True), ('partial', True)])
     cmd = load.load(ui)
     ui.set_command(cmd)
     cmd.repository_factory = memory.RepositoryFactory()
     cmd.repository_factory.initialise(ui.here)
     retcode = cmd.execute()
     self.assertEqual([], ui.outputs)
     self.assertEqual(0, retcode)
     self.assertEqual(True,
         cmd.repository_factory.repos[ui.here].get_test_run(0)._partial)
开发者ID:testing-cabal,项目名称:testrepository,代码行数:11,代码来源:test_load.py

示例11: test_load_returns_1_on_failed_stream

 def test_load_returns_1_on_failed_stream(self):
     buffer = BytesIO()
     stream = subunit.StreamResultToBytes(buffer)
     stream.status(test_id='foo', test_status='inprogress')
     stream.status(test_id='foo', test_status='fail')
     subunit_bytes = buffer.getvalue()
     ui = UI([('subunit', subunit_bytes)])
     cmd = load.load(ui)
     ui.set_command(cmd)
     cmd.repository_factory = memory.RepositoryFactory()
     cmd.repository_factory.initialise(ui.here)
     self.assertEqual(1, cmd.execute())
开发者ID:testing-cabal,项目名称:testrepository,代码行数:12,代码来源:test_load.py

示例12: test_load_abort_over_interactive_stream

 def test_load_abort_over_interactive_stream(self):
     ui = UI([('subunit', b''), ('interactive', b'a\n')])
     cmd = load.load(ui)
     ui.set_command(cmd)
     cmd.repository_factory = memory.RepositoryFactory()
     cmd.repository_factory.initialise(ui.here)
     ret = cmd.execute()
     self.assertEqual(
         ui.outputs,
         [('results', Wildcard),
          ('summary', False, 1, None, None, None,
             [('id', 0, None), ('failures', 1, None)])])
     self.assertEqual(1, ret)
开发者ID:testing-cabal,项目名称:testrepository,代码行数:13,代码来源:test_load.py

示例13: test_load_errors_if_repo_doesnt_exist

 def test_load_errors_if_repo_doesnt_exist(self):
     ui = UI([('subunit', _b(''))])
     cmd = load.load(ui)
     ui.set_command(cmd)
     calls = []
     cmd.repository_factory = RecordingRepositoryFactory(calls,
         memory.RepositoryFactory())
     del calls[:]
     cmd.execute()
     self.assertEqual([('open', ui.here)], calls)
     self.assertEqual([('error', Wildcard)], ui.outputs)
     self.assertThat(
         ui.outputs[0][1], MatchesException(RepositoryNotFound('memory:')))
开发者ID:testing-cabal,项目名称:testrepository,代码行数:13,代码来源:test_load.py

示例14: test_load_new_shows_test_failures

 def test_load_new_shows_test_failures(self):
     buffer = BytesIO()
     stream = subunit.StreamResultToBytes(buffer)
     stream.status(test_id='foo', test_status='inprogress')
     stream.status(test_id='foo', test_status='fail')
     subunit_bytes = buffer.getvalue()
     ui = UI([('subunit', subunit_bytes)])
     cmd = load.load(ui)
     ui.set_command(cmd)
     cmd.repository_factory = memory.RepositoryFactory()
     cmd.repository_factory.initialise(ui.here)
     self.assertEqual(1, cmd.execute())
     self.assertEqual(
         [('summary', False, 1, None, Wildcard, None,
           [('id', 0, None), ('failures', 1, None)])],
         ui.outputs[1:])
开发者ID:testing-cabal,项目名称:testrepository,代码行数:16,代码来源:test_load.py

示例15: test_load_loads_subunit_stream_to_default_repository

 def test_load_loads_subunit_stream_to_default_repository(self):
     ui = UI([('subunit', _b(''))])
     cmd = load.load(ui)
     ui.set_command(cmd)
     calls = []
     cmd.repository_factory = RecordingRepositoryFactory(calls,
         memory.RepositoryFactory())
     repo = cmd.repository_factory.initialise(ui.here)
     del calls[:]
     cmd.execute()
     # Right repo
     self.assertEqual([('open', ui.here)], calls)
     # Stream consumed
     self.assertFalse('subunit' in ui.input_streams)
     # Results loaded
     self.assertEqual(1, repo.count())
开发者ID:testing-cabal,项目名称:testrepository,代码行数:16,代码来源:test_load.py


注:本文中的testrepository.ui.model.UI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。