Skip to content

Commit cb540f6

Browse files
committed
Refactor tests structure
1 parent 38c2cae commit cb540f6

14 files changed

+17
-12
lines changed

tests/test_basic.py renamed to tests/test_builds.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
>>> from pathlib import Path
88
>>> tmp_path = Path(tempfile.gettempdir()) / 'pytest-testname'
99
>>> os.mkdir(tmp_path)
10+
1011
"""
1112

1213
# #############################################################################
@@ -92,7 +93,7 @@ def setup_clean_mkdocs_folder(mkdocs_yml_path, output_path):
9293
shutil.rmtree(str(testproject_path))
9394

9495
# Copy correct mkdocs.yml file and our test 'docs/'
95-
shutil.copytree("tests/basic_setup/docs", str(testproject_path / "docs"))
96+
shutil.copytree("tests/fixtures/basic_project/docs", str(testproject_path / "docs"))
9697
shutil.copyfile(mkdocs_yml_path, str(testproject_path / "mkdocs.yml"))
9798

9899
return testproject_path
@@ -252,7 +253,7 @@ def test_missing_git_repo(tmp_path):
252253
When there is no GIT repo, this should fail
253254
"""
254255
testproject_path = setup_clean_mkdocs_folder(
255-
mkdocs_yml_path="tests/basic_setup/mkdocs.yml", output_path=tmp_path
256+
mkdocs_yml_path="tests/fixtures/basic_project/mkdocs.yml", output_path=tmp_path
256257
)
257258

258259
result = build_docs_setup(testproject_path)
@@ -263,17 +264,19 @@ def test_missing_git_repo(tmp_path):
263264

264265
def test_build_no_options(tmp_path):
265266
# Enable plugin with no extra options set
266-
validate_mkdocs_file(tmp_path, "tests/basic_setup/mkdocs.yml")
267+
validate_mkdocs_file(tmp_path, "tests/fixtures/basic_project/mkdocs.yml")
267268

268269

269270
def test_build_locale_plugin(tmp_path):
270271
# Enable plugin with plugin locale set to 'nl'
271-
validate_mkdocs_file(tmp_path, "tests/basic_setup/mkdocs_plugin_locale.yml")
272+
validate_mkdocs_file(
273+
tmp_path, "tests/fixtures/basic_project/mkdocs_plugin_locale.yml"
274+
)
272275

273276

274277
def test_build_locale_mkdocs(tmp_path):
275278
# Enable plugin with mkdocs locale set to 'fr'
276-
validate_mkdocs_file(tmp_path, "tests/basic_setup/mkdocs_locale.yml")
279+
validate_mkdocs_file(tmp_path, "tests/fixtures/basic_project/mkdocs_locale.yml")
277280

278281

279282
def test_material_theme(tmp_path):
@@ -282,7 +285,7 @@ def test_material_theme(tmp_path):
282285
"""
283286
# theme set to 'material' with 'language' set to 'de'
284287
testproject_path = validate_mkdocs_file(
285-
tmp_path, "tests/basic_setup/mkdocs_theme_locale.yml"
288+
tmp_path, "tests/fixtures/basic_project/mkdocs_theme_locale.yml"
286289
)
287290

288291
# In mkdocs-material, a 'last update' should appear
@@ -298,7 +301,7 @@ def test_material_theme_no_locale(tmp_path):
298301
"""
299302
# theme set to 'material' with 'language' set to 'de'
300303
testproject_path = validate_mkdocs_file(
301-
tmp_path, "tests/basic_setup/mkdocs_theme_no_locale.yml"
304+
tmp_path, "tests/fixtures/basic_project/mkdocs_theme_no_locale.yml"
302305
)
303306

304307
# In mkdocs-material, a 'last update' should appear
@@ -310,17 +313,19 @@ def test_material_theme_no_locale(tmp_path):
310313

311314
def test_type_timeago(tmp_path):
312315
# type: 'timeago'
313-
validate_mkdocs_file(tmp_path, "tests/basic_setup/mkdocs_timeago.yml")
316+
validate_mkdocs_file(tmp_path, "tests/fixtures/basic_project/mkdocs_timeago.yml")
314317

315318

316319
def test_type_datetime(tmp_path):
317320
# type: 'datetime'
318-
validate_mkdocs_file(tmp_path, "tests/basic_setup/mkdocs_datetime.yml")
321+
validate_mkdocs_file(tmp_path, "tests/fixtures/basic_project/mkdocs_datetime.yml")
319322

320323

321324
def test_type_unknown(tmp_path):
322325
with pytest.raises(AssertionError):
323-
validate_mkdocs_file(tmp_path, "tests/basic_setup/mkdocs_unknown_type.yml")
326+
validate_mkdocs_file(
327+
tmp_path, "tests/fixtures/basic_project/mkdocs_unknown_type.yml"
328+
)
324329

325330

326331
def test_git_in_docs_dir(tmp_path):
@@ -330,7 +335,7 @@ def test_git_in_docs_dir(tmp_path):
330335
"""
331336

332337
testproject_path = setup_clean_mkdocs_folder(
333-
"tests/basic_setup/mkdocs.yml", tmp_path
338+
"tests/fixtures/basic_project/mkdocs.yml", tmp_path
334339
)
335340

336341
# Setup git repo in the 'docs' dir
@@ -369,7 +374,7 @@ def test_low_fetch_depth(tmp_path, caplog):
369374
"""
370375

371376
testproject_path = setup_clean_mkdocs_folder(
372-
"tests/basic_setup/mkdocs.yml", tmp_path
377+
"tests/fixtures/basic_project/mkdocs.yml", tmp_path
373378
)
374379
repo = setup_commit_history(testproject_path)
375380

0 commit comments

Comments
 (0)