Exemple #1
0
 def test_invalid_absolute_path(self):
     # Override the configuration value for System.dot_path
     dummy_path = '/not_a_real_path' * 10
     assert not os.path.exists(dummy_path)
     with mock.patch('iris.config.get_option', return_value=dummy_path):
         result = _dot_path()
     self.assertIsNone(result)
Exemple #2
0
 def test_valid_absolute_path(self):
     # Override the configuration value for System.dot_path
     real_path = os.path.abspath(__file__)
     assert os.path.exists(real_path) and os.path.isabs(real_path)
     with mock.patch('iris.config.get_option', return_value=real_path):
         result = _dot_path()
     self.assertEqual(result, real_path)
Exemple #3
0
 def test_valid_relative_path(self):
     # Override the configuration value for System.dot_path
     dummy_path = 'not_a_real_path' * 10
     assert not os.path.exists(dummy_path)
     with mock.patch('iris.config.get_option', return_value=dummy_path):
         # Pretend we have a valid installation of dot
         with mock.patch('subprocess.check_output'):
             result = _dot_path()
     self.assertEqual(result, dummy_path)
Exemple #4
0
 def test_valid_relative_path_broken_install(self):
     # Override the configuration value for System.dot_path
     dummy_path = 'not_a_real_path' * 10
     assert not os.path.exists(dummy_path)
     with mock.patch('iris.config.get_option', return_value=dummy_path):
         # Pretend we have a broken installation of dot
         error = subprocess.CalledProcessError(-5, 'foo', 'bar')
         with mock.patch('subprocess.check_output', side_effect=error):
             result = _dot_path()
     self.assertIsNone(result)