예제 #1
0
 def test_no_executable(self, mock_check_output):
     '''
     Check build_r()'s behaviour when R is not recognised as
     an executable.
     '''
     mock_check_output.side_effect = \
         fx.make_r_side_effect(recognized = False)
     with self.assertRaises(ExecCallError):
         helpers.standard_test(self, gs.build_r, 'R', 
                               system_mock = mock_check_output)
예제 #2
0
    def test_unintended_inputs(self, mock_check_output):
        # We expect build_r() to raise an error if its env
        # argument does not support indexing by strings.
        mock_check_output.side_effect = fx.make_r_side_effect(True)

        check = lambda **kwargs: helpers.input_check(self, gs.build_r, 'r', **
                                                     kwargs)

        for bad_env in [True, (1, 2), TypeError]:
            check(env=bad_env, error=TypeError)
예제 #3
0
 def test_standard(self, mock_check_output):
     '''Test build_r()'s behaviour when given standard inputs.'''
     mock_check_output.side_effect = fx.make_r_side_effect(True)
     helpers.standard_test(self, gs.build_r, 'R', 
                           system_mock = mock_check_output)
     # With a list of targets
     # We expect that build_r() can run without creating its targets
     targets = ['./build/r.rds', 'additional_target', '']
     helpers.standard_test(self, gs.build_r, 'R', 
                           system_mock = mock_check_output,
                           target      = targets)    
예제 #4
0
 def test_standard(self, mock_check_output):
     '''Test build_r()'s behaviour when given standard inputs.'''
     mock_check_output.side_effect = fx.make_r_side_effect(True)
     helpers.standard_test(self,
                           gs.build_r,
                           'R',
                           system_mock=mock_check_output)
     # With a list of targets
     targets = ['./test_output.txt']
     helpers.standard_test(self,
                           gs.build_r,
                           'R',
                           system_mock=mock_check_output,
                           target=targets)
예제 #5
0
 def test_cl_arg(self, mock_check_output):
     mock_check_output.side_effect = fx.make_r_side_effect(True)
     helpers.test_cl_args(self, gs.build_r, mock_check_output, 'R')