示例#1
0
 def test_invalid_verbosity_and_processes(self):
     """
     If an invalid combination of verbosity and number of processors is passed in, a
     BuildFailure should be raised
     """
     suite = BokChoyTestSuite('', num_processes=2, verbosity=3)
     with self.assertRaises(BuildFailure):
         BokChoyTestSuite.verbosity_processes_string(suite)
 def test_invalid_verbosity_and_processes(self):
     """
     If an invalid combination of verbosity and number of processors is passed in, a
     BuildFailure should be raised
     """
     suite = BokChoyTestSuite('', num_processes=2, verbosity=3)
     with self.assertRaises(BuildFailure):
         BokChoyTestSuite.verbosity_processes_string(suite)
示例#3
0
 def test_verbosity_settings_1_process(self):
     """
     Using 1 process means paver should ask for the traditional xunit plugin for plugin results
     """
     expected_verbosity_string = (
         "--with-xunit --xunit-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml --verbosity=2"
         .format(repo_dir=REPO_DIR,
                 shard_str='/shard_' + self.shard if self.shard else ''))
     suite = BokChoyTestSuite('', num_processes=1)
     self.assertEqual(BokChoyTestSuite.verbosity_processes_string(suite),
                      expected_verbosity_string)
示例#4
0
 def test_verbosity_settings_3_processes(self):
     """
     With the above test, validate that num_processes can be set to various values
     """
     process_count = 3
     expected_verbosity_string = (
         "--with-xunitmp --xunitmp-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml"
         " --processes={procs} --no-color --process-timeout=1200".format(
             repo_dir=REPO_DIR,
             shard_str='/shard_' + self.shard if self.shard else '',
             procs=process_count))
     suite = BokChoyTestSuite('', num_processes=process_count)
     self.assertEqual(BokChoyTestSuite.verbosity_processes_string(suite),
                      expected_verbosity_string)
示例#5
0
 def test_verbosity_settings_2_processes(self):
     """
     Using multiple processes means specific xunit, coloring, and process-related settings should
     be used.
     """
     process_count = 2
     expected_verbosity_string = (
         "--with-xunitmp --xunitmp-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml"
         " --processes={procs} --no-color --process-timeout=1200".format(
             repo_dir=REPO_DIR,
             shard_str='/shard_' + self.shard if self.shard else '',
             procs=process_count))
     suite = BokChoyTestSuite('', num_processes=process_count)
     self.assertEqual(BokChoyTestSuite.verbosity_processes_string(suite),
                      expected_verbosity_string)
 def test_test_dir(self):
     test_dir = 'foo'
     suite = BokChoyTestSuite('', test_dir=test_dir)
     self.assertEqual(
         suite.cmd,
         self._expected_command(name=test_dir)
     )
示例#7
0
 def test_verify_xss_env_var(self):
     self.env_var_override.set('VERIFY_XSS', 'False')
     with self.env_var_override:
         suite = BokChoyTestSuite('')
         name = 'tests'
         self.assertEqual(
             suite.cmd, self._expected_command(name=name, verify_xss=False))
 def test_invalid_default_store(self):
     # the cmd will dumbly compose whatever we pass in for the default_store
     suite = BokChoyTestSuite('', default_store='invalid')
     name = 'tests'
     self.assertEqual(
         suite.cmd,
         self._expected_command(name=name, store='invalid')
     )
 def test_spec_with_draft_default_store(self):
     spec = 'test_foo.py'
     suite = BokChoyTestSuite('', test_spec=spec, default_store='draft')
     name = 'tests/{}'.format(spec)
     self.assertEqual(
         suite.cmd,
         self._expected_command(name=name, store='draft')
     )
示例#10
0
 def test_invalid_verbosity_and_processes(self):
     """
     If an invalid combination of verbosity and number of processors is passed in, a
     BuildFailure should be raised
     """
     suite = BokChoyTestSuite('', num_processes=2, verbosity=3)
     with self.assertRaises(BuildFailure):
         # pylint: disable=pointless-statement
         suite.verbosity_processes_command
 def test_verbosity_settings_1_process(self):
     """
     Using 1 process means paver should ask for the traditional xunit plugin for plugin results
     """
     expected_verbosity_string = (
         "--with-xunit --xunit-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml --verbosity=2".format(
             repo_dir=REPO_DIR,
             shard_str='/shard_' + self.shard if self.shard else ''
         )
     )
     suite = BokChoyTestSuite('', num_processes=1)
     self.assertEqual(BokChoyTestSuite.verbosity_processes_string(suite), expected_verbosity_string)
 def test_verbosity_settings_1_process(self):
     """
     Using 1 process means paver should ask for the traditional xunit plugin for plugin results
     """
     expected_verbosity_command = [
         "--junitxml={repo_dir}/reports/bok_choy{shard_str}/xunit.xml".format(
             repo_dir=REPO_DIR,
             shard_str='/shard_' + self.shard if self.shard else ''
         ),
         "--verbose",
     ]
     suite = BokChoyTestSuite('', num_processes=1)
     self.assertEqual(suite.verbosity_processes_command, expected_verbosity_command)
 def test_verbosity_settings_3_processes(self):
     """
     With the above test, validate that num_processes can be set to various values
     """
     process_count = 3
     expected_verbosity_string = (
         "--with-xunitmp --xunitmp-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml"
         " --processes={procs} --no-color --process-timeout=1200".format(
             repo_dir=REPO_DIR,
             shard_str='/shard_' + self.shard if self.shard else '',
             procs=process_count
         )
     )
     suite = BokChoyTestSuite('', num_processes=process_count)
     self.assertEqual(BokChoyTestSuite.verbosity_processes_string(suite), expected_verbosity_string)
 def test_verbosity_settings_3_processes(self):
     """
     With the above test, validate that num_processes can be set to various values
     """
     process_count = 3
     expected_verbosity_command = [
         "--junitxml={repo_dir}/reports/bok_choy{shard_str}/xunit.xml".format(
             repo_dir=REPO_DIR,
             shard_str='/shard_' + self.shard if self.shard else '',
         ),
         u"-n {}".format(process_count),
         "--color=no",
         "--verbose",
     ]
     suite = BokChoyTestSuite('', num_processes=process_count)
     self.assertEqual(suite.verbosity_processes_command, expected_verbosity_command)
 def test_verbosity_settings_2_processes(self):
     """
     Using multiple processes means specific xunit, coloring, and process-related settings should
     be used.
     """
     process_count = 2
     expected_verbosity_string = (
         "--with-xunitmp --xunitmp-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml"
         " --processes={procs} --no-color --process-timeout=1200".format(
             repo_dir=REPO_DIR,
             shard_str='/shard_' + self.shard if self.shard else '',
             procs=process_count
         )
     )
     suite = BokChoyTestSuite('', num_processes=process_count)
     self.assertEqual(BokChoyTestSuite.verbosity_processes_string(suite), expected_verbosity_string)
 def test_verbosity_settings_2_processes(self):
     """
     Using multiple processes means specific xunit, coloring, and process-related settings should
     be used.
     """
     process_count = 2
     expected_verbosity_command = [
         "--junitxml={repo_dir}/reports/bok_choy{shard_str}/xunit.xml".format(
             repo_dir=REPO_DIR,
             shard_str='/shard_' + self.shard if self.shard else '',
         ),
         u"-n {}".format(process_count),
         "--color=no",
         "--verbose",
     ]
     suite = BokChoyTestSuite('', num_processes=process_count)
     self.assertEqual(suite.verbosity_processes_command, expected_verbosity_command)
示例#17
0
 def test_testcase_spec(self):
     spec = 'test_foo.py:FooTest.test_bar'
     suite = BokChoyTestSuite('', test_spec=spec)
     name = f'tests/{spec}'
     assert suite.cmd == self._expected_command(name=name)
示例#18
0
 def test_verify_xss(self):
     suite = BokChoyTestSuite('', verify_xss=True)
     name = 'tests'
     self.assertEqual(suite.cmd,
                      self._expected_command(name=name, verify_xss=True))
示例#19
0
 def test_serversonly(self):
     suite = BokChoyTestSuite('', serversonly=True)
     self.assertEqual(suite.cmd, None)
示例#20
0
 def test_testcase_spec(self):
     spec = 'test_foo.py:FooTest.test_bar'
     suite = BokChoyTestSuite('', test_spec=spec)
     name = 'tests/{}'.format(spec)
     self.assertEqual(suite.cmd, self._expected_command(name=name))
示例#21
0
 def test_default(self):
     suite = BokChoyTestSuite('')
     name = 'tests'
     self.assertEqual(suite.cmd, self._expected_command(name=name))
示例#22
0
 def test_test_dir(self):
     test_dir = 'foo'
     suite = BokChoyTestSuite('', test_dir=test_dir)
     assert suite.cmd == self._expected_command(name=test_dir)
示例#23
0
 def test_default(self):
     suite = BokChoyTestSuite('')
     name = 'tests'
     assert suite.cmd == self._expected_command(name=name)
示例#24
0
 def test_class_spec(self):
     spec = 'test_foo.py:FooTest'
     suite = BokChoyTestSuite('', test_spec=spec)
     name = 'tests/{}'.format(spec)
     assert suite.cmd == self._expected_command(name=name)
示例#25
0
 def test_serversonly(self):
     suite = BokChoyTestSuite('', serversonly=True)
     assert suite.cmd is None
示例#26
0
 def test_spec_with_draft_default_store(self):
     spec = 'test_foo.py'
     suite = BokChoyTestSuite('', test_spec=spec, default_store='draft')
     name = f'tests/{spec}'
     assert suite.cmd == self._expected_command(name=name, store='draft')