Skip to content

Commit 21b8014

Browse files
crazymerlyndavehunt
authored andcommitted
Refactor css config code
Change the default value for `--css` option to an empty array instead of None since the config reading code is doing that manually.
1 parent 2671fba commit 21b8014

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pytest_html/plugin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ def pytest_addoption(parser):
5656
'that the report may not render or function where CSP '
5757
'restrictions are in place (see '
5858
'https://developer.mozilla.org/docs/Web/Security/CSP)')
59-
group.addoption('--css', action='append', metavar='path',
59+
group.addoption('--css', action='append', metavar='path', default=[],
6060
help='append given css file content to report style file.')
6161

6262

6363
def pytest_configure(config):
6464
htmlpath = config.getoption('htmlpath')
6565
if htmlpath:
66-
for csspath in config.getoption('css') or []:
66+
for csspath in config.getoption('css'):
6767
open(csspath)
6868
if not hasattr(config, 'slaveinput'):
6969
# prevent opening htmlpath on slave nodes (xdist)
@@ -329,7 +329,7 @@ def _generate_report(self, session):
329329
self.style_css += '\n'.join(ansi_css)
330330

331331
# <DF> Add user-provided CSS
332-
for path in self.config.getoption('css') or []:
332+
for path in self.config.getoption('css'):
333333
self.style_css += '\n/******************************'
334334
self.style_css += '\n * CUSTOM CSS'
335335
self.style_css += '\n * {}'.format(path)

0 commit comments

Comments
 (0)