def _set_pythonpath(self): """Add user configured paths to PYTHONAPATH. """ for path in self._settings.get('pythonpath', []): if path not in sys.path: normalized = path.replace('/', os.sep) sys.path.insert(0, normalized) RideLogMessage(u'Inserted \'{0}\' to sys.path.'.format( normalized)).publish()
def get_and_insert_keywords(self, library_name, library_args): result_queue = Queue.Queue(maxsize=1) self._messages.put( ('insert', library_name, library_args, result_queue), timeout=3) try: return result_queue.get(timeout=5) except Queue.Empty as e: RideLogMessage(u'Failed to read keywords from library db: {}' .format(unicode(e))).publish() return []
def test_log_message(self): msg = RideLogMessage(message='Some error text', level='ERROR') assert_equals(msg.message, 'Some error text') assert_equals(msg.level, 'ERROR') assert_true(msg.timestamp.startswith('20'))