Skip to content

Commit b1656a2

Browse files
committed
Better replacement strategy for test id
1 parent 121fadc commit b1656a2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pytest_html/plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import time
1616
import bisect
1717
import warnings
18+
import re
1819

1920
try:
2021
from ansi2html import Ansi2HTMLConverter, style
@@ -168,7 +169,7 @@ def create_asset(
168169
):
169170
# 255 is the common max filename length on various filesystems
170171
asset_file_name = "{}_{}_{}.{}".format(
171-
self.test_id.replace(":", "_"),
172+
re.sub(r"[^\w\.]", "_", self.test_id),
172173
str(extra_index),
173174
str(test_index),
174175
file_extension,

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
envlist = py{27,36,37,py,py3}{,-ansi2html}, flake8, black
88

99
[testenv]
10-
commands = pytest -v -r a {posargs}
10+
setenv = PYTHONDONTWRITEBYTECODE=1
1111
deps =
1212
pytest-xdist
1313
pytest-rerunfailures
1414
pytest-mock
1515
py{27,36,py,py3}-ansi2html: ansi2html
16+
commands = pytest -v -r a {posargs}
1617

1718
[testenv:flake8]
1819
skip_install = true

0 commit comments

Comments
 (0)