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)
def testNotImplemented(self, path, process_options): process_options.return_value = ('a', []) self.assertRaises(NotImplementedError, runner.AbstractRunner().run)
def testLogConfigBasenamePath(self, path): runner.AbstractRunner().process_options() self.assertEqual('loggity.logs', mandrel.bootstrap.LOGGING_CONFIG_BASENAME)
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])
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])
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)
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')