Skip to content

Commit

Permalink
Add tox configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja committed Sep 28, 2022
1 parent c460105 commit 25c8dcb
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.{py,cfg}]
[*.{py,cfg,ini}]
indent_size = 4

[*.{py,md}]
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,31 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python v${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip coveralls
python -m pip install .[test]
pip list
- name: Test with pytest
run: pytest -svv
python -m pip install --upgrade pip coveralls tox
- name: Pick environment to run
shell: python
run: |
import codecs; import os; import sys
env = f"TOXENV=py3{sys.version_info[0]}\n"
print("Picked:\n{env}for{sys.version}")
with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler:
file_handler.write(env)
- name: Run tests
run: tox
env:
PYTEST_ADDOPTS: -vv
- name: Coveralls
run: coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
- name: Test examples
run: pytest -svv tests/_test_examples.py
run: tox -e examples

build-sdist:
if: startsWith(github.ref, 'refs/tags/')
Expand Down
1 change: 1 addition & 0 deletions mkdocs_include_markdown_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def on_serve(self, server, builder, **kwargs):
SERVER = server
self._watch_included_files()

@mkdocs.plugins.event_priority(-100)
def on_page_markdown(self, markdown, page, **kwargs):
global WATCHING_FILES
if WATCHING_FILES is None:
Expand Down
10 changes: 4 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,15 @@ mkdocs.plugins =
dev =
bump2version==1.0.1
mkdocs==1.4.0
pre-commit==2.13.0
pytest==6.2.5
pre-commit
pytest==7.1.3
pytest-cov==3.0.0
tox
test =
mkdocs==1.4.0
pytest==6.2.5
pytest==7.1.3
pytest-cov==3.0.0

[tool:pytest]
addopts = --cov=mkdocs_include_markdown_plugin --cov-report=html --cov-config=setup.cfg

[coverage:run]
omit = mkdocs_include_markdown_plugin/plugin.py

Expand Down
18 changes: 18 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[tox]
envlist = py3{7,8,9,10}-mkdocs{131,140}
skip_missing_interpreters = true

[testenv]
extras =
test
deps =
mkdocs131: mkdocs==1.3.1
mkdocs140: mkdocs==1.4.0
commands = pytest --cov=mkdocs_include_markdown_plugin \
--cov-report=html \
--cov-config=setup.cfg \
{posargs}
package = wheel

[testenv:examples]
commands = pytest tests/_test_examples.py {posargs}

0 comments on commit 25c8dcb

Please sign in to comment.