Release v1.22.1
This commit is contained in:
parent
1b1eab1176
commit
b9fd59df02
14
CHANGES.rst
14
CHANGES.rst
|
@ -1,6 +1,20 @@
|
|||
Release Notes
|
||||
-------------
|
||||
|
||||
**1.22.1 (2019-10-05)**
|
||||
|
||||
* Properly check for presence of CSS file. (`#246 <https://github.com/pytest-dev/pytest-html/issues/246>`_)
|
||||
|
||||
* Thanks to `@wanam <https://github.com/wanam>`_ for reporting, and `@krzysztof-pawlik-gat <https://github.com/krzysztof-pawlik-gat>`_ for the fix
|
||||
|
||||
* Added support for UTF-8 display. (`#244 <https://github.com/pytest-dev/pytest-html/pull/244>`_)
|
||||
|
||||
* Thanks to `@Izhu666 <https://github.com/lzhu666>`_ for the PR
|
||||
|
||||
* Fix initial sort on column. (`#247 <https://github.com/pytest-dev/pytest-html/issues/247>`_)
|
||||
|
||||
* Thanks to `@wanam <https://github.com/wanam>`_ for reporting and fixing
|
||||
|
||||
**1.22.0 (2019-08-06)**
|
||||
|
||||
* Refactor assets naming to be more readable and OS safe.
|
||||
|
|
|
@ -79,7 +79,10 @@ def pytest_configure(config):
|
|||
htmlpath = config.getoption("htmlpath")
|
||||
if htmlpath:
|
||||
for csspath in config.getoption("css"):
|
||||
open(csspath)
|
||||
if not os.path.exists(csspath):
|
||||
raise IOError(
|
||||
"No such file or directory: '{csspath}'".format(csspath=csspath)
|
||||
)
|
||||
if not hasattr(config, "slaveinput"):
|
||||
# prevent opening htmlpath on slave nodes (xdist)
|
||||
config._html = HTMLReport(htmlpath, config)
|
||||
|
@ -114,7 +117,7 @@ class HTMLReport(object):
|
|||
|
||||
class TestResult:
|
||||
def __init__(self, outcome, report, logfile, config):
|
||||
self.test_id = report.nodeid
|
||||
self.test_id = report.nodeid.encode("utf-8").decode("unicode_escape")
|
||||
if getattr(report, "when", "call") != "call":
|
||||
self.test_id = "::".join([report.nodeid, report.when])
|
||||
self.time = getattr(report, "duration", 0.0)
|
||||
|
|
|
@ -111,7 +111,7 @@ function init () {
|
|||
|
||||
show_filters();
|
||||
|
||||
toggle_sort_states(find('.initial-sort'));
|
||||
sort_column(find('.initial-sort'));
|
||||
|
||||
find_all('.sortable').forEach(function(elem) {
|
||||
elem.addEventListener("click",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# coding: utf-8
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
@ -816,7 +817,7 @@ class TestHTML:
|
|||
assert re.search(regex_error, html) is not None
|
||||
|
||||
@pytest.mark.parametrize("colors", [(["red"]), (["green", "blue"])])
|
||||
def test_css(self, testdir, colors):
|
||||
def test_css(self, testdir, recwarn, colors):
|
||||
testdir.makepyfile("def test_pass(): pass")
|
||||
css = {}
|
||||
cssargs = []
|
||||
|
@ -827,17 +828,33 @@ class TestHTML:
|
|||
cssargs.extend(["--css", path])
|
||||
result, html = run(testdir, "report.html", "--self-contained-html", *cssargs)
|
||||
assert result.ret == 0
|
||||
assert len(recwarn) == 0
|
||||
for k, v in css.items():
|
||||
assert str(v["path"]) in html
|
||||
assert v["style"] in html
|
||||
|
||||
def test_css_invalid(self, testdir):
|
||||
def test_css_invalid(self, testdir, recwarn):
|
||||
testdir.makepyfile("def test_pass(): pass")
|
||||
result = testdir.runpytest("--html", "report.html", "--css", "style.css")
|
||||
assert result.ret
|
||||
assert len(recwarn) == 0
|
||||
assert "No such file or directory: 'style.css'" in result.stderr.str()
|
||||
|
||||
def test_css_invalid_no_html(self, testdir):
|
||||
testdir.makepyfile("def test_pass(): pass")
|
||||
result = testdir.runpytest("--css", "style.css")
|
||||
assert result.ret == 0
|
||||
|
||||
def test_report_display_utf8(self, testdir):
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
# coding: utf-8
|
||||
import pytest
|
||||
@pytest.mark.parametrize("utf8", [("测试用例名称")])
|
||||
def test_pass(utf8):
|
||||
assert True
|
||||
"""
|
||||
)
|
||||
result, html = run(testdir)
|
||||
assert result.ret == 0
|
||||
assert r"\u6d4b\u8bd5\u7528\u4f8b\u540d\u79f0" not in html
|
||||
|
|
Loading…
Reference in New Issue