• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmdline.main函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tinkerer.cmdline.main函数的典型用法代码示例。如果您正苦于以下问题:Python main函数的具体用法?Python main怎么用?Python main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了main函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_post_with_date

    def test_post_with_date(self):
        cmdline.main(["--post", "Dated Post", "--date", "2011/11/20"])

        file_path = os.path.join(utils.TEST_ROOT, "2011/11/20", "dated_post.rst")

        # assert file exists
        self.assertTrue(os.path.exists(file_path))
开发者ID:dhellmann,项目名称:tinkerer,代码行数:7,代码来源:test_cmdline.py


示例2: test_draft

    def test_draft(self):
        cmdline.main(["--draft", "My Draft", "--quiet"])

        file_path = os.path.join(utils.TEST_ROOT, "drafts", "my_draft.rst")

        # assert draft was created
        self.assertTrue(os.path.exists(file_path))
开发者ID:Brother-Simon,项目名称:tinkerer,代码行数:7,代码来源:test_cmdline.py


示例3: test_page_from_title

    def test_page_from_title(self):
        cmdline.main(["--page", "My Test Page", "--quiet"])

        file_path = os.path.join(utils.TEST_ROOT, "pages", "my_test_page.rst")

        # assert file exsits
        self.assertTrue(os.path.exists(file_path))
开发者ID:Brother-Simon,项目名称:tinkerer,代码行数:7,代码来源:test_cmdline.py


示例4: test_date_only_on_post

    def test_date_only_on_post(self):
        self.assertNotEqual(0,
                cmdline.main(["--page", "Test Page", "--date", "2011/11/20"]))

        self.assertNotEqual(0,
                cmdline.main(["--draft", "Test Draft", "--date", "2011/11/20"]))

        self.assertNotEqual(0,
                cmdline.main(["--build", "--date", "2011/11/20"]))
开发者ID:dhellmann,项目名称:tinkerer,代码行数:9,代码来源:test_cmdline.py


示例5: test_post_from_title

    def test_post_from_title(self):
        cmdline.main(["--post", "My Test Post", "--quiet"])

        # this might fail at midnight :P
        year, month, day = tinkerer.utils.split_date()

        file_path = os.path.join(utils.TEST_ROOT, year, month, day, "my_test_post.rst")

        # assert file exists
        self.assertTrue(os.path.exists(file_path))
开发者ID:dhellmann,项目名称:tinkerer,代码行数:10,代码来源:test_cmdline.py


示例6: test_setup

    def test_setup(self):
        # blog is setup as part of test setup, tear it down and re-create it via
        # cmdline
        self.tearDown()
        cmdline.main(["--setup", "--quiet"])

        self.assertEqual(
            set(os.listdir(utils.TEST_ROOT)),
            set(["_static", "_templates", "drafts", "conf.py", "index.html", tinkerer.master_doc + ".rst"]),
        )
开发者ID:johnnywsd,项目名称:tinkerer,代码行数:10,代码来源:test_cmdline.py


示例7: test_root_only

    def test_root_only(self):
        # remove "conf.py" created by test setup
        os.remove(os.path.join(paths.root, "conf.py"))

        self.assertNotEqual(0, cmdline.main(["--page", "Test Post", "--quiet"]))

        self.assertNotEqual(0, cmdline.main(["--post", "Test Page", "--quiet"]))

        self.assertNotEqual(0, cmdline.main(["--build", "--quiet"]))

        # setup should work fine from anywhere
        self.assertEqual(0, cmdline.main(["--setup", "--quiet"]))
开发者ID:johnnywsd,项目名称:tinkerer,代码行数:12,代码来源:test_cmdline.py


示例8: test_filename_only

    def test_filename_only(self):
        # hook up test log handler
        test_stream = StringIO()

        # restore logging for this particular test
        logging.disable(logging.NOTSET)

        output.filename.addHandler(logging.StreamHandler(test_stream))

        # setup new blog with --filename flag
        cmdline.main(["--setup", "--filename"])

        # output should be `conf.py`
        self.assertEquals("conf.py", test_stream.getvalue().strip())
开发者ID:Brother-Simon,项目名称:tinkerer,代码行数:14,代码来源:test_cmdline.py


示例9: test_post_from_existing_file

    def test_post_from_existing_file(self):
        # create file
        draft_file = os.path.join(utils.TEST_ROOT, "drafts", "draft_page.rst")

        with open(draft_file, "w") as f:
            f.write("Content")

        cmdline.main(["--page", draft_file, "--quiet"])

        file_path = os.path.join(utils.TEST_ROOT, "pages", "draft_page.rst")

        # assert file exists and check content
        self.assertTrue(os.path.exists(file_path))
        with open(file_path, "r") as f:
            self.assertEquals("Content", f.read())
开发者ID:Brother-Simon,项目名称:tinkerer,代码行数:15,代码来源:test_cmdline.py


示例10: test_missing_template

 def test_missing_template(self):
     # creating a post with a missing template file should fail
     self.assertNotEqual(
         0,
         cmdline.main(["--post", "test", "--template", "missing",
                       "--quiet"])
     )
开发者ID:Brother-Simon,项目名称:tinkerer,代码行数:7,代码来源:test_cmdline.py


示例11: test_post_from_path

    def test_post_from_path(self):
        # create file
        draft_file = os.path.join(utils.TEST_ROOT, "drafts", "draft_post.rst")

        with open(draft_file, "w") as f:
            f.write("Content")

        cmdline.main(["--post", draft_file, "--quiet"])

        # this might also fail at midnight :P
        year, month, day = tinkerer.utils.split_date()

        file_path = os.path.join(utils.TEST_ROOT, year, month, day, "draft_post.rst")

        # assert file exists and check content
        self.assertTrue(os.path.exists(file_path))
        with open(file_path, "r") as f:
            self.assertEquals("Content", f.read())
开发者ID:dhellmann,项目名称:tinkerer,代码行数:18,代码来源:test_cmdline.py


示例12: test_setup

    def test_setup(self):
        # blog is setup as part of test setup, tear it down and
        # re-create it via cmdline
        self.tearDown()
        cmdline.main(["--setup", "--quiet"])

        self.assertEqual(
            set(os.listdir(utils.TEST_ROOT)),
            set([
                "_static",
                "_templates",
                "drafts",
                "conf.py",
                "index.html",
                tinkerer.master_doc + ".rst"
            ]))

        # favicon should be copied to the blog _static folder
        self.assertTrue(os.path.exists(
            os.path.join(utils.TEST_ROOT, "_static", paths.favicon)
            ))
开发者ID:Brother-Simon,项目名称:tinkerer,代码行数:21,代码来源:test_cmdline.py


示例13: test_preview

    def test_preview(self):
        # create a post
        new_post = post.create("A post", datetime.datetime(2010, 10, 1))

        # post should be in master doc (precondition)
        lines = master.read_master()
        self.assertTrue("   %s\n" % new_post.docname in lines)

        # create a draft
        new_draft = draft.create("draft")
        self.assertTrue(os.path.exists(new_draft))

        # preview it (build should succeed)
        self.assertEqual(0, cmdline.main(["--preview", new_draft, "-q"]))

        # draft should not be in TOC
        for line in master.read_master():
            self.assertFalse("draft" in line)
开发者ID:johnnywsd,项目名称:tinkerer,代码行数:18,代码来源:test_draft.py


示例14:

from tinkerer import cmdline
import sys

cmdline.main(sys.argv[1:])

开发者ID:jcrudy,项目名称:jcrudy.github.io,代码行数:4,代码来源:main.py



注:本文中的tinkerer.cmdline.main函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python page.create函数代码示例发布时间:2022-05-27
下一篇:
Python logger.info函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap