def test_ajust_log_path_app_path(self): app_path = os.path.join('../', os.path.dirname(__file__), 'app-path') sys.argv[1:] = ['--app-path=%s' % app_path] opt = parser.parse_args() self.cli._set_loggers(opt) handlers = self.cli.log.handlers self.assertTrue(isinstance(handlers[0], logging.FileHandler)) self.assertEquals(os.path.join(app_path, 'logs/wsgid.log'), handlers[0].baseFilename)
def setUp(self): self.cli = Cli() # As we are dealing with a command line test, we have do clean the passed arguments # so the tested applications does not try to use them sys.argv[1:] = [] self.fake_app_path = os.path.join('../', os.path.dirname(__file__), 'app-path') # Ok, not pretty but better than re-implementing this in python os.system("rm -rf {0}".format(os.path.join(self.fake_app_path, 'pid/'))) self.cli.options = parser.parse_args() self.cli.options.app_path = self.fake_app_path
def _parse(self, *opts): sys.argv[1:] = opts return self.cli._create_daemon_options(parser.parse_args())