Beispiel #1
0
 def test_writes_queue_info_to_stdout(self, capfd, pop_interval, enqueue_kwargs):
     """ Should write info about the queue to stdout """
     settings = {"testers": [{"test_data": [{"category": ["admin"], "timeout": 10}]}]}
     with tmp_script_dir(settings):
         cli.enqueue_tests(**enqueue_kwargs)
     out, _err = capfd.readouterr()
     assert re.search(r"^\d+$", out) is not None
Beispiel #2
0
 def test_can_find_test_files(self, enqueue_kwargs):
     """ Should be able to find test files """
     try:
         settings = {"testers": [{"test_data": [{"category": ["admin"], "timeout": 10}]}]}
         with tmp_script_dir(settings):
             cli.enqueue_tests(**enqueue_kwargs)
     except cli.TestScriptFilesError:
         pytest.fail("should not have failed because test scripts do exist for this test")
Beispiel #3
0
 def test_can_enqueue_test_with_timeout(self, mock_enqueue_call, enqueue_kwargs):
     """ Should set the job timeout when enqueuing """
     settings = {"testers": [{"test_data": [{"category": ["admin"], "timeout": 10}]}]}
     with tmp_script_dir(settings):
         cli.enqueue_tests(**enqueue_kwargs)
         mock_enqueue_call.assert_called_with(ANY, kwargs=ANY, job_id=ANY, timeout=15)
Beispiel #4
0
 def test_can_find_tests_in_given_category(self, enqueue_kwargs):
     """ Should enqueue if there are tests to run """
     settings = {"testers": [{"test_data": [{"category": ["admin"], "timeout": 30}]}]}
     with tmp_script_dir(settings):
         cli.enqueue_tests(**enqueue_kwargs)
Beispiel #5
0
 def test_fails_if_no_tests_to_run(self, enqueue_kwargs):
     """ Should not enqueue if there are no tests to run """
     settings = {"testers": [{"test_data": []}]}
     with tmp_script_dir(settings):
         with pytest.raises(cli.TestParameterError):
             cli.enqueue_tests(**enqueue_kwargs)
Beispiel #6
0
 def test_fails_if_test_data_is_empty(self, enqueue_kwargs):
     """ Should not enqueue if there is no test data """
     enqueue_kwargs["test_data"] = []
     with pytest.raises(cli.TestParameterError):
         cli.enqueue_tests(**enqueue_kwargs)
Beispiel #7
0
 def test_fails_if_test_files_do_not_exist(self, non_existant_test_script_dir, enqueue_kwargs):
     """ Should not enqueue if test files do not exist """
     with pytest.raises(cli.TestScriptFilesError):
         cli.enqueue_tests(**enqueue_kwargs)