Example #1
0
def benchmark(post_count, iterations):
    print("Running benchmark with %d posts, %d iterations" %
          (post_count, iterations))

    times = []

    # setup blog
    setup()

    # load content
    lorem = load_content()

    # create posts
    for i in range(post_count):
        post.create("Post %d" % i).write(tags="tag #%d" % i, content=lorem)

    for i in range(iterations):
        print("Iteration %d..." % i)

        start = datetime.datetime.now()
        cmdline.build()
        times.append(datetime.datetime.now() - start)

        print(times[-1])

    # cleanup test dir
    cleanup()

    print("Average time: %s" %
          (sum(times, datetime.timedelta(0)) / len(times)))
Example #2
0
def build_theme(use_theme):
    # setup blog
    setup()

    # write conf file with given theme
    writer.write_conf_file(theme=use_theme)

    # load content
    lorem = load_content()

    # create posts
    post.create("This is a post",
                datetime.date(2010, 10, 1)).write(tags="tag #1, tag #2",
                                                  content=lorem)
    post.create("This is another post", datetime.date(2010, 11,
                                                      2)).write(tags="tag #1",
                                                                content=lorem)
    post.create("This is yet another post",
                datetime.date(2010, 12, 3)).write(tags="tag #2", content=lorem)

    # create pages
    page.create("First page").write()
    page.create("Second page").write()

    # build
    cmdline.build()
Example #3
0
def benchmark(post_count, iterations):
    print("Running benchmark with %d posts, %d iterations" %
            (post_count, iterations))

    times = []

    # setup blog
    setup()

    # load content
    lorem = load_content()

    # create posts
    for i in range(post_count):
        post.create("Post %d" % i).write(
                tags="tag #%d" % i,
                content=lorem)

    for i in range(iterations):
        print("Iteration %d..." % i)

        start = datetime.datetime.now()
        cmdline.build()
        times.append(datetime.datetime.now() - start)

        print(times[-1])

    # cleanup test dir
    cleanup()

    print("Average time: %s" % (sum(times, datetime.timedelta(0)) / len(times)))
Example #4
0
def build_theme(use_theme):
    # setup blog
    setup()

    # write conf file with given theme
    writer.write_conf_file(theme=use_theme)

    # load content
    lorem = load_content()

    # create posts
    post.create("This is a post", datetime.date(2010, 10, 1)).write(
            tags="tag #1, tag #2",
            content=lorem)
    post.create("This is another post", datetime.date(2010, 11, 2)).write(
            tags="tag #1",
            content=lorem)
    post.create("This is yet another post", datetime.date(2010, 12, 3)).write(
            tags="tag #2",
            content=lorem)

    # create pages
    page.create("First page").write()
    page.create("Second page").write()

    # build
    cmdline.build()
Example #5
0
def build_all_themes():
    '''
    Builds all themes
    '''
    # remove previous theme build output if any
    shutil.rmtree("themes", True)

    for theme in OTHER_THEMES:
        print("Building theme %s" % (theme,))
        update_conf(theme)
        cmdline.build()
        move_theme(theme)

    update_conf(DEFAULT_THEME)
    cmdline.build()
Example #6
0
 def build(self):
     print("")
     self.assertEquals(0, cmdline.build())
Example #7
0
 def build(self):
     print("")
     self.assertEquals(0, cmdline.build())