Merging upstream version 1.2.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
ae7b7df396
commit
afeccccd6a
154 changed files with 7346 additions and 5000 deletions
|
@ -5,4 +5,4 @@
|
|||
|
||||
from tests.units.result_manager.conftest import list_result_factory, result_manager, result_manager_factory, test_result_factory
|
||||
|
||||
__all__ = ["result_manager", "result_manager_factory", "list_result_factory", "test_result_factory"]
|
||||
__all__ = ["list_result_factory", "result_manager", "result_manager_factory", "test_result_factory"]
|
||||
|
|
|
@ -188,5 +188,5 @@ class TestReportJinja:
|
|||
|
||||
def test_fail__init__file_not_found(self) -> None:
|
||||
"""Test __init__ failure if file is not found."""
|
||||
with pytest.raises(FileNotFoundError, match="template file is not found: /gnu/terry/pratchett"):
|
||||
with pytest.raises(FileNotFoundError, match=r"template file is not found: [/|\\]gnu[/|\\]terry[/|\\]pratchett"):
|
||||
ReportJinja(Path("/gnu/terry/pratchett"))
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import csv
|
||||
import pathlib
|
||||
from typing import Any, Callable
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -49,8 +50,8 @@ class TestReportCsv:
|
|||
# Generate the CSV report
|
||||
ReportCsv.generate(result_manager, csv_filename)
|
||||
|
||||
# Read the generated CSV file
|
||||
with pathlib.Path.open(csv_filename, encoding="utf-8") as csvfile:
|
||||
# Read the generated CSV file - newline required on Windows..
|
||||
with pathlib.Path.open(csv_filename, encoding="utf-8", newline="") as csvfile:
|
||||
reader = csv.reader(csvfile, delimiter=",")
|
||||
rows = list(reader)
|
||||
|
||||
|
@ -82,11 +83,9 @@ class TestReportCsv:
|
|||
max_test_entries = 10
|
||||
result_manager = result_manager_factory(max_test_entries)
|
||||
|
||||
# Create a temporary CSV file path and make tmp_path read_only
|
||||
tmp_path.chmod(0o400)
|
||||
csv_filename = tmp_path / "read_only.csv"
|
||||
|
||||
with pytest.raises(OSError, match="Permission denied"):
|
||||
with patch("pathlib.Path.open", side_effect=OSError("Any OSError")), pytest.raises(OSError, match="Any OSError"):
|
||||
# Generate the CSV report
|
||||
ReportCsv.generate(result_manager, csv_filename)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from io import StringIO
|
||||
from io import BytesIO, TextIOWrapper
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
@ -46,7 +46,7 @@ def test_md_report_base() -> None:
|
|||
|
||||
results = ResultManager()
|
||||
|
||||
with StringIO() as mock_file:
|
||||
with TextIOWrapper(BytesIO(b"1 2 3")) as mock_file:
|
||||
report = FakeMDReportBase(mock_file, results)
|
||||
assert report.generate_heading_name() == "Fake MD Report Base"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue