Пример #1
0
 def testOrderOfOperations(self, path, execute, process_options):
     mocks = [mock.Mock('positional%d' % x) for x in xrange(4)]
     target = mocks.pop(0)
     process_options.return_value = (target, mocks)
     runner.AbstractRunner().run()
     process_options.assert_called_once_with()
     execute.assert_called_once_with(target, mocks)
Пример #2
0
 def testNotImplemented(self, path, process_options):
     process_options.return_value = ('a', [])
     self.assertRaises(NotImplementedError, runner.AbstractRunner().run)
Пример #3
0
 def testLogConfigBasenamePath(self, path):
     runner.AbstractRunner().process_options()
     self.assertEqual('loggity.logs',
                      mandrel.bootstrap.LOGGING_CONFIG_BASENAME)
Пример #4
0
 def testAppendModulePath(self, path):
     orig = len(sys.path)
     runner.AbstractRunner().process_options()
     self.assertEqual(orig + 1, len(sys.path))
     self.assertEqual(os.path.join(KNOWN_PATH, 'florp'), sys.path[-1])
Пример #5
0
 def testAppendSearchPath(self, path):
     runner.AbstractRunner().process_options()
     self.assertEqual(2, len(mandrel.bootstrap.SEARCH_PATHS))
     self.assertEqual(os.path.join(path, 'foof'),
                      mandrel.bootstrap.SEARCH_PATHS[-1])
Пример #6
0
 def testSearchPathSet(self, path):
     paths = [os.path.join(path, p) for p in ('foo', 'bar', 'bah')] + [path]
     result = runner.AbstractRunner().process_options()
     self.assertEqual(paths, list(mandrel.bootstrap.SEARCH_PATHS))
     self.assertEqual(('gloof', ['glof', 'floo']), result)
Пример #7
0
 def testImporting(self, _):
     obj = runner.AbstractRunner()
     with mock.patch('__builtin__.__import__') as importer:
         self.assertEqual(importer.return_value.bootstrap, obj.bootstrapper)
         importer.assert_called_once_with('mandrel.bootstrap')