예제 #1
0
 def test_unable_to_find(self, exists):
     from jove.scripts.main import get_default_config
     assert isinstance(exists, mock.Mock)
     exists_values = [False, False, False]
     def side_effect(*args, **kw):
         return exists_values.pop(0)
     exists.side_effect = side_effect
     with self.assertRaises(ValueError):
         get_default_config()
     self.assertEqual(exists.call_count, 3)
     self.assertEqual(exists.call_args_list, [
         (('jove.ini',), {}),
         (('/venv/etc/jove.ini',), {}),
         (('etc/jove.ini',), {}),
     ])
예제 #2
0
 def test_found_in_curdir(self, exists):
     from jove.scripts.main import get_default_config
     assert isinstance(exists, mock.Mock)
     exists_values = [True]
     def side_effect(*args, **kw):
         return exists_values.pop(0)
     exists.side_effect = side_effect
     self.assertEqual(get_default_config(), '/abs/path/jove.ini')
     self.assertEqual(exists.call_count, 1)
     self.assertEqual(exists.call_args_list, [
         (('jove.ini',), {}),
     ])