What's the error
Assume none of the CSS files are present in the directory.
if I run pytest --html=report.html --css=abc.css --css=xyz.css, It should give me error stating that abc.css and xyz.css files were not found.
Actual Output
But the current pytest version gives error for only the first CSS file abc.css and ignores xyz.css (which means it will report error for only the first --css argument if it's file is not found).
$ pytest --html=report.html --css=abc.css --css=xyz.css
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 253, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 982, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 308, in call_historic
INTERNALERROR> res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pytest_html/plugin.py", line 92, in pytest_configure
INTERNALERROR> raise OSError(f"No such file or directory: '{csspath}'")
INTERNALERROR> OSError: No such file or directory: 'abc.css'
Expected Output
You can clone and install the css-file-reporting branch of my fork here. It is a fix for this issue.
I installed the fixed version of pytest-html through pip install --editable . and it properly reports the missing CSS files.
$ pytest --html=report.html --css=abc.css --css=xyz.css
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 253, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 982, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 308, in call_historic
INTERNALERROR> res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/Users/prakhargurunani/Desktop/pytest-html/src/pytest_html/plugin.py", line 99, in pytest_configure
INTERNALERROR> raise OSError(f"No such file or directory: '{no_files_found}'")
INTERNALERROR> OSError: No such file or directory: 'abc.css, xyz.css'
@nicoddemus Please see this.
What's the error
Assume none of the CSS files are present in the directory.
if I run
pytest --html=report.html --css=abc.css --css=xyz.css, It should give me error stating thatabc.cssandxyz.cssfiles were not found.Actual Output
But the current pytest version gives error for only the first CSS file
abc.cssand ignoresxyz.css(which means it will report error for only the first--cssargument if it's file is not found).$ pytest --html=report.html --css=abc.css --css=xyz.css INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 253, in wrap_session INTERNALERROR> config._do_configure() INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 982, in _do_configure INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self)) INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 308, in call_historic INTERNALERROR> res = self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda> INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pytest_html/plugin.py", line 92, in pytest_configure INTERNALERROR> raise OSError(f"No such file or directory: '{csspath}'") INTERNALERROR> OSError: No such file or directory: 'abc.css'Expected Output
You can clone and install the
css-file-reportingbranch of my fork here. It is a fix for this issue.I installed the fixed version of
pytest-htmlthroughpip install --editable .and it properly reports the missing CSS files.$ pytest --html=report.html --css=abc.css --css=xyz.css INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 253, in wrap_session INTERNALERROR> config._do_configure() INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 982, in _do_configure INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self)) INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 308, in call_historic INTERNALERROR> res = self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda> INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/Users/prakhargurunani/Desktop/pytest-html/src/pytest_html/plugin.py", line 99, in pytest_configure INTERNALERROR> raise OSError(f"No such file or directory: '{no_files_found}'") INTERNALERROR> OSError: No such file or directory: 'abc.css, xyz.css'@nicoddemus Please see this.