Skip to content

Commit

Permalink
Merge pull request #21 from WiredNerd/dev
Browse files Browse the repository at this point in the history
🔧 Fix build for html reporter
  • Loading branch information
WiredNerd committed Jan 3, 2024
2 parents e3e2a02 + bdfca0e commit 533450d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-platform-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ jobs:
- name: Poodle example project
run : |
cd example
poodle
poodle --report summary --report not_found --report json --report html
- name: Poodle example flat project
run : |
cd example2
poodle
poodle --report summary --report not_found --report json --report html
9 changes: 5 additions & 4 deletions .github/workflows/update-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,30 @@ jobs:
pip install -r requirements.txt --upgrade
pip install --editable .
- name: pytest
run: pytest --cov=src --cov-context=test --cov-report=json:code-coverage.json || true
run: pytest --cov=src --cov-context=test --cov-report=json:code-coverage.json
- name: commit-json-report
if: ${{ github.ref_name == 'main' }}
if: ${{ always() && github.ref_name == 'main' }}
uses: EndBug/add-and-commit@v9
with:
add: "code-coverage.json"
pull: "--rebase=true --autostash"
message: ':robot: Update Coverage Report'
- name: artifact-html-report
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: Coverage Report
path: cov-html
- name: Poodle
run: poodle --report json || true
run: poodle --report json --report html
- name: Upload Report HTML
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: Mutation testing report HTML
path: mutation_reports
- name: save-json-report
if: ${{ github.ref_name == 'main' }}
if: ${{ always() && github.ref_name == 'main' }}
uses: EndBug/add-and-commit@v9
with:
add: "mutation-testing-report.json"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Homepage](https://img.shields.io/badge/Homepage-github-white?logo=github)](https://github.com/WiredNerd/poodle)
[![python>=3.9](https://img.shields.io/badge/python->=3.9-orange?logo=python&logoColor=green)](https://pypi.org/project/poodle)
[![python 3.9 - 3.12](https://img.shields.io/badge/python-3.9%20to%203.12-orange?logo=python&logoColor=green)](https://pypi.org/project/poodle)
[![PyPI - Version](https://img.shields.io/pypi/v/poodle?logo=pypi&logoColor=white)](https://pypi.org/project/poodle)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/poodle)](https://pypistats.org/packages/poodle)
[![PyPI - License](https://img.shields.io/pypi/l/poodle)](https://github.com/WiredNerd/poodle/blob/main/LICENSE)
Expand All @@ -26,6 +26,7 @@ The goal of Poodle is to be highly efficient, configurable, and extendable.
* Multi-Threaded execution
* Highly Configurable (toml and py)
* Plug in custom code
* Output reports in Text, HTML, and JSON

## Quick Start

Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "poodle"
description = "Mutation Testing Tool"
version = "1.2.0"
version = "1.2.1"
license = { file = "LICENSE" }
keywords = [
"test",
Expand Down Expand Up @@ -45,6 +45,12 @@ poodle = "poodle.cli:main"

[tool.setuptools]

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
"poodle.templates" = ["*.*"]

[tool.pytest.ini_options]
pythonpath = ["src"]
testpaths = ["tests"]
Expand Down
2 changes: 1 addition & 1 deletion src/poodle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pathlib import Path
from typing import Any

__version__ = "1.2.0"
__version__ = "1.2.1"


class PoodleInputError(ValueError):
Expand Down
4 changes: 2 additions & 2 deletions src/poodle/reporters/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ def report_html(config: PoodleConfig, echo: Callable, testing_results: TestingRe
index_template = env.get_template("html-report-index.html.jinja")
index_page = index_template.render(total=testing_results.summary, modules=modules, **common_vars)
index_file = report_folder / "index.html"
index_file.write_text(index_page.strip())
index_file.write_text(index_page.strip(), encoding="utf-8")

module_template = env.get_template("html-report-module.html.jinja")
for source_file, module in modules.items():
module_page = module_template.render(source_file=source_file, module=module, **common_vars)
(report_folder / module["report_file"]).write_text(module_page.strip())
(report_folder / module["report_file"]).write_text(module_page.strip(), encoding="utf-8")

echo(f"HTML Report Generated at {index_file.resolve()}")

Expand Down
10 changes: 8 additions & 2 deletions tests/reporters/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,15 @@ def test_report_html_output(
report_folder.__truediv__.assert_has_calls(
[
mock.call("index.html"),
mock.call().write_text(env.get_template.return_value.render.return_value.strip.return_value),
mock.call().write_text(
env.get_template.return_value.render.return_value.strip.return_value,
encoding="utf-8",
),
mock.call(module["report_file"]),
mock.call().write_text(env.get_template.return_value.render.return_value.strip.return_value),
mock.call().write_text(
env.get_template.return_value.render.return_value.strip.return_value,
encoding="utf-8",
),
]
)

Expand Down

0 comments on commit 533450d

Please sign in to comment.