Пример #1
0
 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
Пример #2
0
    def run(self):
        os.getcwd()
        os.chdir(self.testr_directory)
        self._ui.c = self.testr_directory + 'tempest.conf'

        cmd = run.run(self._ui)

        return cmd.execute()
Пример #3
0
    def run(self):
        os.getcwd()
        os.chdir(self.testr_directory)
        self._ui.c = self.testr_directory+'tempest.conf'

        cmd = run.run(self._ui)

        return cmd.execute()
Пример #4
0
 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
Пример #5
0
 def test_list_tests_requests_concurrency_instances(self):
     # testr list-tests is non-parallel, so needs 1 instance.
     # testr run triggering list-tests will want to run parallel on all, so
     # avoid latency by asking for whatever concurrency is up front.
     # This covers the case for non-listing runs as well, as the code path
     # is common.
     self.dirty()
     ui = UI(options=[('concurrency', 2), ('parallel', True)])
     ui.here = self.tempdir
     cmd = run.run(ui)
     ui.set_command(cmd)
     ui.proc_outputs = [_b('returned\ninstances\n')]
     command = self.useFixture(TestCommand(ui, None))
     self.set_config(
         '[DEFAULT]\ntest_command=foo $LISTOPT $IDLIST\ntest_id_list_default=whoo yea\n'
         'test_list_option=--list\n'
         'instance_provision=provision -c $INSTANCE_COUNT\n'
         'instance_execute=quux $INSTANCE_ID -- $COMMAND\n')
     fixture = self.useFixture(command.get_run_command(test_ids=['1']))
     fixture.list_tests()
     self.assertEqual(set([_b('returned'), _b('instances')]),
                      command._instances)
     self.assertEqual(set([]), command._allocated_instances)
     self.assertThat(
         ui.outputs,
         MatchesAny(
             Equals([
                 ('values', [('running', 'provision -c 2')]),
                 ('popen', ('provision -c 2', ), {
                     'shell': True,
                     'stdout': -1
                 }), ('communicate', ),
                 ('values', [('running',
                              'quux instances -- foo --list whoo yea')]),
                 ('popen', ('quux instances -- foo --list whoo yea', ), {
                     'shell': True,
                     'stdin': -1,
                     'stdout': -1
                 }), ('communicate', )
             ]),
             Equals([('values', [('running', 'provision -c 2')]),
                     ('popen', ('provision -c 2', ), {
                         'shell': True,
                         'stdout': -1
                     }), ('communicate', ),
                     ('values', [('running',
                                  'quux returned -- foo --list whoo yea')]),
                     ('popen', ('quux returned -- foo --list whoo yea', ), {
                         'shell': True,
                         'stdin': -1,
                         'stdout': -1
                     }), ('communicate', )])))
Пример #6
0
def get_test_ui_and_cmd(options=(), args=()):
    stdout = TextIOWrapper(BytesIO(), 'utf8', line_buffering=True)
    stdin = StringIO()
    stderr = StringIO()
    argv = list(args)
    for option, value in options:
        # only bool handled so far
        if value:
            argv.append('--%s' % option)
    ui = cli.UI(argv, stdin, stdout, stderr)
    cmd = run.run(ui)
    ui.set_command(cmd)
    return ui, cmd
Пример #7
0
def get_test_ui_and_cmd(options=(), args=()):
    stdout = TextIOWrapper(BytesIO(), 'utf8', line_buffering=True)
    stdin = StringIO()
    stderr = StringIO()
    argv = list(args)
    for option, value in options:
        # only bool handled so far
        if value:
            argv.append('--%s' % option)
    ui = cli.UI(argv, stdin, stdout, stderr)
    cmd = run.run(ui)
    ui.set_command(cmd)
    return ui, cmd
Пример #8
0
 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
 def test_list_tests_requests_concurrency_instances(self):
     # testr list-tests is non-parallel, so needs 1 instance.
     # testr run triggering list-tests will want to run parallel on all, so
     # avoid latency by asking for whatever concurrency is up front.
     # This covers the case for non-listing runs as well, as the code path
     # is common.
     self.dirty()
     ui = UI(options= [('concurrency', 2), ('parallel', True)])
     ui.here = self.tempdir
     cmd = run.run(ui)
     ui.set_command(cmd)
     ui.proc_outputs = [_b('returned\ninstances\n')]
     command = self.useFixture(TestCommand(ui, None))
     self.set_config(
         '[DEFAULT]\ntest_command=foo $LISTOPT $IDLIST\ntest_id_list_default=whoo yea\n'
         'test_list_option=--list\n'
         'instance_provision=provision -c $INSTANCE_COUNT\n'
         'instance_execute=quux $INSTANCE_ID -- $COMMAND\n')
     fixture = self.useFixture(command.get_run_command(test_ids=['1']))
     fixture.list_tests()
     self.assertEqual(set([_b('returned'), _b('instances')]), command._instances)
     self.assertEqual(set([]), command._allocated_instances)
     self.assertThat(ui.outputs, MatchesAny(Equals([
         ('values', [('running', 'provision -c 2')]),
         ('popen', ('provision -c 2',), {'shell': True, 'stdout': -1}),
         ('communicate',),
         ('values', [('running', 'quux instances -- foo --list whoo yea')]),
         ('popen',('quux instances -- foo --list whoo yea',),
          {'shell': True, 'stdin': -1, 'stdout': -1}),
         ('communicate',)]), Equals([
         ('values', [('running', 'provision -c 2')]),
         ('popen', ('provision -c 2',), {'shell': True, 'stdout': -1}),
         ('communicate',),
         ('values', [('running', 'quux returned -- foo --list whoo yea')]),
         ('popen',('quux returned -- foo --list whoo yea',),
          {'shell': True, 'stdin': -1, 'stdout': -1}),
         ('communicate',)])))