Ejemplo n.º 1
0
 def test_override(self):
     '''Ensure we can track overrides from one file or another'''
     shovel = Shovel()
     for name in ['one', 'two']:
         pth = 'test/examples/overrides/%s' % name
         shovel.read(pth, pth)
     self.assertNotEqual(shovel, None)
     self.assertNotEqual(shovel['foo.bar'].overrides, None)
Ejemplo n.º 2
0
 def test_multi_load(self):
     '''Load from multiple paths'''
     shovel = Shovel()
     shovel.read('test/examples/multiple/one/',
         'test/examples/multiple/one/')
     shovel.read('test/examples/multiple/two/',
         'test/examples/multiple/two/')
     keys = [
         'whiz', 'bar.bar'
     ]
     self.assertEqual(set(shovel.keys()), set(keys))
Ejemplo n.º 3
0
    def test_errors(self):
        '''Make sure getting non-existant tasks throws errors'''
        shovel = Shovel()
        self.assertRaises(KeyError, shovel.__getitem__, 'foo.bar.whiz')
        self.assertRaises(KeyError, shovel.__getitem__, 'foo')
        self.assertFalse('foo' in shovel)

        # We can't have functor classes that take arguments
        shovel.read('test/examples/errors/')
        self.assertFalse('Foo' in shovel)

        self.assertRaises(TypeError, Task, 'foo')