예제 #1
0
    def start(self):
        create_folder(admin_dir)

        self.lock = Lock(admin_dir +
                         "/profile-{}.lock".format(self.profile.name))
        if self.lock.acquire(False) is False:
            print_error(
                "Process for profile '{}' is already running, exit!".format(
                    self.profile.name))

        try:
            self.cp = CommandProcessor(self)
        except Exception as e:
            print_error(traceback.format_exc())

        ret = os.fork()
        if ret != 0:  # in parent process...
            print "Process {} is created for profile '{}'".format(
                ret, self.profile.name)
            sys.exit(0)
        """ Go into background now """
        # TODO: redirect stdout, stderr
        try:
            self.run()
        except Exception as e:
            LogFatal(traceback.format_exc())
예제 #2
0
class CommandProcessorTest(unittest.TestCase):
    commandProcessor = None
    rawRequest = "look at me"

    def setUp(self):
        self.commandProcessor = CommandProcessor()

    def testProcess(self):
        self.assertIsInstance(self.commandProcessor.process("rawRequest", MagicMock()), CommandRequest)
예제 #3
0
 def setUp(self):
     self.commandProcessor = CommandProcessor()