示例#1
0
    def test_target_invalid(self):
        """ test Initiator target path invalid, raise OSError
        """

        target_error = "/foo/bar/why/not"
        i = Initiator(self.config_file, target_error)
        self.assertRaises(OSError, lambda: i.init())
示例#2
0
    def test_target_invalid(self):
        """ test Initiator target path invalid, raise OSError
        """

        target_error = "/foo/bar/why/not"
        i = Initiator(self.config_file, target_error)
        self.assertRaises(OSError, lambda: i.init())
示例#3
0
文件: cli.py 项目: ferstar/simiki
def init_site(target_path):
    default_config_file = os.path.join(os.path.dirname(__file__),
                                       "conf_templates", "_config.yml.in")
    try:
        initiator = Initiator(default_config_file, target_path)
        initiator.init()
    except Exception:
        # always in debug mode when init site
        logging.exception("Initialize site with error:")
        sys.exit(1)
示例#4
0
文件: cli.py 项目: Aden404/simiki
def init_site(target_path):
    default_config_file = os.path.join(os.path.dirname(__file__),
                                       "conf_templates",
                                       "_config.yml.in")
    try:
        initiator = Initiator(default_config_file, target_path)
        initiator.init()
    except Exception:
        # always in debug mode when init site
        logging.exception("Initialize site with error:")
        sys.exit(1)
示例#5
0
    def test_target_exist(self):
        """ test Initiator target path exist
        """

        i = Initiator(self.config_file, self.target_path)
        i.init(ask=False)

        for f in self.files:
            self.assertTrue(os.path.isfile(os.path.join(self.target_path, f)))

        for d in self.dirs:
            self.assertTrue(os.path.isdir(os.path.join(self.target_path, d)))
示例#6
0
    def test_target_exist(self):
        """ test Initiator target path exist
        """

        i = Initiator(self.config_file, self.target_path)
        i.init()

        for f in self.files:
            self.assertTrue(os.path.isfile(os.path.join(self.target_path, f)))

        for d in self.dirs:
            self.assertTrue(os.path.isdir(os.path.join(self.target_path, d)))