Skip to content

Commit 606be8f

Browse files
committed
Pass all plugin config - achieving test cleaning
1 parent d48ada7 commit 606be8f

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tests/test_basic.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,9 @@
2626
# other 3rd party
2727
import git
2828
import pytest
29-
import yaml
3029
from click.testing import CliRunner
3130

3231
# package module
33-
from mkdocs_git_revision_date_localized_plugin.plugin import (
34-
GitRevisionDateLocalizedPlugin,
35-
)
3632
from mkdocs_git_revision_date_localized_plugin.util import Util
3733

3834
# #############################################################################
@@ -44,10 +40,11 @@
4440
# custom log level to get plugin info messages
4541
logging.basicConfig(level=logging.INFO)
4642

43+
4744
# #############################################################################
4845
# ########## Helpers ###############
4946
# ##################################
50-
def get_locale_from_config(mkdocs_path):
47+
def get_plugin_config_from_mkdocs(mkdocs_path) -> dict:
5148
# instanciate plugin
5249
cfg_mkdocs = load_config(mkdocs_path)
5350

@@ -65,7 +62,7 @@ def get_locale_from_config(mkdocs_path):
6562
"Locale '%s' determined from %s"
6663
% (plugin_loaded.config.get("locale"), mkdocs_path)
6764
)
68-
return plugin_loaded.config.get("locale")
65+
return plugin_loaded.config
6966

7067

7168
def setup_clean_mkdocs_folder(mkdocs_yml_path, output_path):
@@ -179,7 +176,7 @@ def build_docs_setup(testproject_path):
179176
raise
180177

181178

182-
def validate_build(testproject_path, project_locale: str):
179+
def validate_build(testproject_path, plugin_config: dict):
183180
"""
184181
Validates a build from a testproject
185182
@@ -200,7 +197,9 @@ def validate_build(testproject_path, project_locale: str):
200197

201198
repo = Util(testproject_path)
202199
date_formats = repo.get_revision_date_for_file(
203-
path=testproject_path / "docs/page_with_tag.md", locale=project_locale
200+
path=testproject_path / "docs/page_with_tag.md",
201+
locale=plugin_config.get("locale"),
202+
fallback_to_build_date=plugin_config.get("fallback_to_build_date"),
204203
)
205204

206205
searches = [re.search(x, contents) for x in date_formats.values()]
@@ -225,7 +224,7 @@ def validate_mkdocs_file(temp_path: str, mkdocs_yml_file: str):
225224

226225
# validate build with locale retrieved from mkdocs config file
227226
validate_build(
228-
testproject_path, project_locale=get_locale_from_config(mkdocs_yml_file)
227+
testproject_path, plugin_config=get_plugin_config_from_mkdocs(mkdocs_yml_file)
229228
)
230229

231230
return testproject_path

0 commit comments

Comments
 (0)