Skip to content

Commit ccfbf39

Browse files
committed
Add unit test for building empty site
1 parent eb713dc commit ccfbf39

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

tests/basic_setup/empty_site/index.md

Whitespace-only changes.

tests/test_basic.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,37 @@ def test_project_with_no_commits(tmp_path):
7777
)
7878

7979
os.chdir(cwd)
80+
81+
82+
def test_building_empty_site(tmp_path):
83+
"""
84+
Structure:
85+
86+
tmp_path/testproject
87+
website/
88+
├── docs/
89+
└── mkdocs.yml"""
90+
testproject_path = tmp_path / "testproject"
91+
92+
shutil.copytree(
93+
"tests/basic_setup/empty_site", str(testproject_path / "website" / "docs")
94+
)
95+
shutil.copyfile(
96+
"tests/basic_setup/mkdocs_w_contribution.yml",
97+
str(testproject_path / "website" / "mkdocs.yml"),
98+
)
99+
100+
cwd = os.getcwd()
101+
os.chdir(str(testproject_path))
102+
103+
# run 'git init'
104+
gitpython.Repo.init(testproject_path, bare=False)
105+
106+
result = build_docs_setup(
107+
str(testproject_path / "website/mkdocs.yml"), str(testproject_path / "site")
108+
)
109+
assert result.exit_code == 0, (
110+
"'mkdocs build' command failed. Error: %s" % result.stdout
111+
)
112+
113+
os.chdir(cwd)

0 commit comments

Comments
 (0)