New config option: enabled_on_serve#81
Merged
timvink merged 2 commits intotimvink:masterfrom Mar 12, 2024
Merged
Conversation
timvink
approved these changes
Mar 8, 2024
Owner
|
Thanks for taking the time to write this! LGTM |
Owner
|
I think the change might have disabled the plugin for some of the unit tests. Did the tests work locally? |
Contributor
Author
Hm, looks good locally: (.venv) ~/projects/mkdocs-git-authors-plugin (80-enabled_on_serve)
└─ $ ▶ git log -1
commit 072704756f14511d0a48af5a3a94e5825d7d2efb (HEAD -> 80-enabled_on_serve, origin/80-enabled_on_serve)
Author: Thomas Breitner <[email protected]>
Date: Tue Mar 5 16:30:50 2024 +0100
New config option: enabled_on_serve
(.venv) ~/projects/mkdocs-git-authors-plugin (80-enabled_on_serve)
└─ $ ▶ pytest tests -vv
============================================================== test session starts ===============================================================
platform linux -- Python 3.11.8, pytest-8.0.2, pluggy-1.4.0 -- ~/projects/mkdocs-git-authors-plugin/.venv/bin/python3
cachedir: .pytest_cache
rootdir: ~/projects/mkdocs-git-authors-plugin
plugins: cov-4.1.0, mock-3.12.0
collected 23 items
tests/test_basic.py::test_basic_working[mkdocs.yml] PASSED [ 4%]
tests/test_basic.py::test_basic_working[mkdocs_complete_material_disabled.yml] PASSED [ 8%]
tests/test_basic.py::test_basic_working[mkdocs_complete_material.yml] PASSED [ 13%]
tests/test_basic.py::test_basic_working[mkdocs_exclude.yml] PASSED [ 17%]
tests/test_basic.py::test_basic_working[mkdocs_fallback.yml] PASSED [ 21%]
tests/test_basic.py::test_basic_working[mkdocs_genfiles.yml] PASSED [ 26%]
tests/test_basic.py::test_basic_working[mkdocs_no_email.yml] PASSED [ 30%]
tests/test_basic.py::test_basic_working[mkdocs_w_contribution_and_author_threshold.yml] PASSED [ 34%]
tests/test_basic.py::test_basic_working[mkdocs_w_contribution_sort_and_author_threshold.yml] PASSED [ 39%]
tests/test_basic.py::test_basic_working[mkdocs_w_contribution.yml] PASSED [ 43%]
tests/test_basic.py::test_basic_working[mkdocs_w_macros.yml] PASSED [ 47%]
tests/test_basic.py::test_basic_working[mkdocs_w_macros2.yml] PASSED [ 52%]
tests/test_basic.py::test_no_email PASSED [ 56%]
tests/test_basic.py::test_exclude_working PASSED [ 60%]
tests/test_basic.py::test_exclude_working_with_genfiles PASSED [ 65%]
tests/test_basic.py::test_enabled_working PASSED [ 69%]
tests/test_basic.py::test_project_with_no_commits PASSED [ 73%]
tests/test_basic.py::test_building_empty_site PASSED [ 78%]
tests/test_basic.py::test_fallback PASSED [ 82%]
tests/test_util.py::test_empty_file PASSED [ 86%]
tests/test_util.py::test_retrieve_authors PASSED [ 91%]
tests/test_util.py::test_mkdocs_in_git_subdir PASSED [ 95%]
tests/test_util.py::test_summarize_authors PASSED [100%]
=============================================================== 23 passed in 1.34s ===============================================================And the specific test from (.venv) ~/projects/mkdocs-git-authors-plugin (80-enabled_on_serve)
└─ $ ▶ pytest --cov=mkdocs_git_authors_plugin --cov-report=xml
============================================================== test session starts ===============================================================
platform linux -- Python 3.11.8, pytest-8.0.2, pluggy-1.4.0
rootdir: ~/projects/mkdocs-git-authors-plugin
plugins: cov-4.1.0, mock-3.12.0
collected 23 items
tests/test_basic.py ................... [ 82%]
tests/test_util.py .... [100%]
---------- coverage: platform linux, python 3.11.8-final-0 -----------
Coverage XML written to file coverage.xml
=============================================================== 23 passed in 2.59s =============================================================== |
…epth to 0 to fetch all history for all branches and tags; Bumped actions/checkout to v4
Owner
|
Thanks !! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As mentioned in #80 this PR introduces a new config option
enabled_on_serve. This allows you to deactivate this plugin whenmkdocsis called with the commandserve.The wording/naming for this new config option is inspired by https://github.com/squidfunk/mkdocs-material/blob/master/src/plugins/info/config.py#L31
As I struggled writing a test where the MkDocs
servecommand is involved, this PR comes without a test (for now)...But honestly, I'm not sure if this new option is even necessary: the existing
enabledoption plus an environment variable works just fine.