Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Not all missing CSS files are reported #388

Closed
FirePing32 opened this issue Nov 29, 2020 · 3 comments · Fixed by #390
Closed

[BUG] Not all missing CSS files are reported #388

FirePing32 opened this issue Nov 29, 2020 · 3 comments · Fixed by #390
Assignees
Labels
bug This issue/PR relates to a bug.

Comments

@FirePing32
Copy link
Contributor

FirePing32 commented Nov 29, 2020

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.

@FirePing32 FirePing32 changed the title [BUG] Not all missing CSS files are repor [BUG] Not all missing CSS files are reported Nov 29, 2020
@BeyondEvil
Copy link
Contributor

Could you create a PR with the fix? @prakhargurunani 🙏

@FirePing32
Copy link
Contributor Author

@BeyondEvil Sure ! Was just waiting for confirmation from dev team 🙂.

@FirePing32
Copy link
Contributor Author

@BeyondEvil See #390

@gnikonorov gnikonorov added the bug This issue/PR relates to a bug. label Nov 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants