1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
"""Test if PAGE_INDEX works, with different PRETTY_URLS=True."""
import os
import pytest
import nikola.plugins.command.init
from nikola import __main__
from .helper import append_config, cd
from .test_empty_build import ( # NOQA
test_archive_exists,
test_avoid_double_slash_in_rss,
test_check_files,
test_check_links,
test_index_in_sitemap,
)
from .test_page_index_normal_urls import create_pages
from .test_page_index_normal_urls import ( # NOQA
test_page_index,
test_page_index_in_subdir,
test_page_index_content_in_pages,
test_page_index_content_in_subdir1,
test_page_index_content_in_subdir2,
test_page_index_content_in_subdir3,
)
@pytest.fixture(scope="module")
def output_path_func():
def output_path(dir, name):
"""Make a file path to the output."""
return os.path.join(dir, name + "/index.html")
return output_path
@pytest.fixture(scope="module")
def build(target_dir):
"""Build the site."""
init_command = nikola.plugins.command.init.CommandInit()
init_command.create_empty_site(target_dir)
init_command.create_configuration(target_dir)
create_pages(target_dir)
append_config(
target_dir,
"""
PAGE_INDEX = True
PRETTY_URLS = True
PAGES = PAGES + (('pages/*.php', 'pages', 'page.tmpl'),)
""",
)
with cd(target_dir):
__main__.main(["build"])
|