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

Validate HTML/CSS/... #872

Open
The-Compiler opened this issue Aug 13, 2015 · 8 comments
Open

Validate HTML/CSS/... #872

The-Compiler opened this issue Aug 13, 2015 · 8 comments
Labels
component: tests Issues related to the testsuite. priority: 2 - low Issues which are currently not very important.

Comments

@The-Compiler
Copy link
Member

The HTML/CSS/... shipped with qutebrowser should be validated by rendering it (either a minimal version via utils.jinja or by calling the real code) and then be validated.

I can think of various methods to do so:

  • Using lxml.etree:
parser = lxml.etree.HTMLParser(recover=False)
lxml.etree.fromstring(html, parser)
@The-Compiler The-Compiler added the component: tests Issues related to the testsuite. label Aug 13, 2015
@neeasade
Copy link
Contributor

So the files that need to be validated can be located like so?

$ find . | grep -vE "htmlcov|json" | grep -E "\.html|\.css|\.js"

./.tox/py34/lib/python3.4/site-packages/pytest_html/resources/main.js
./.tox/py34/lib/python3.4/site-packages/pytest_html/resources/style.css
./.tox/py34/lib/python3.4/site-packages/coverage/htmlfiles/index.html
./.tox/py34/lib/python3.4/site-packages/coverage/htmlfiles/coverage_html.js
./.tox/py34/lib/python3.4/site-packages/coverage/htmlfiles/pyfile.html
./.tox/py34/lib/python3.4/site-packages/coverage/htmlfiles/jquery.tablesorter.min.js
./.tox/py34/lib/python3.4/site-packages/coverage/htmlfiles/jquery.debounce.min.js
./.tox/py34/lib/python3.4/site-packages/coverage/htmlfiles/jquery.min.js
./.tox/py34/lib/python3.4/site-packages/coverage/htmlfiles/jquery.hotkeys.js
./.tox/py34/lib/python3.4/site-packages/coverage/htmlfiles/jquery.isonscreen.js
./.tox/py34/lib/python3.4/site-packages/coverage/htmlfiles/style.css
./.tox/py34/lib/python3.4/site-packages/qutebrowser/javascript/position_caret.js
./.tox/py34/lib/python3.4/site-packages/qutebrowser/html/error.html
./.tox/py34/lib/python3.4/site-packages/qutebrowser/html/dirbrowser.html
./.tox/py34/lib/python3.4/site-packages/qutebrowser/html/COPYING.html
./.tox/py34/lib/python3.4/site-packages/qutebrowser/html/base.html
./.tox/py34/lib/python3.4/site-packages/qutebrowser/html/settings.html
./.tox/py34/lib/python3.4/site-packages/qutebrowser/html/log.html
./.tox/py34/lib/python3.4/site-packages/qutebrowser/html/pre.html
./.tox/py34/lib/python3.4/site-packages/qutebrowser/html/version.html
./tests/html/jsconfirm.html
./tests/html/jsprompt.html
./tests/html/jsalert_multiline.html
./tests/unit/javascript/base.html
./tests/unit/javascript/position_caret/simple.html
./tests/unit/javascript/position_caret/scrolled_down_img.html
./tests/unit/javascript/position_caret/scrolled_down.html
./tests/unit/javascript/position_caret/invisible.html
./tests/unit/browser/test_webelem_jsescape.html
./qutebrowser/javascript/position_caret.js
./qutebrowser/html/error.html
./qutebrowser/html/dirbrowser.html
./qutebrowser/html/COPYING.html
./qutebrowser/html/base.html
./qutebrowser/html/settings.html
./qutebrowser/html/log.html
./qutebrowser/html/pre.html
./qutebrowser/html/version.html

@The-Compiler
Copy link
Member Author

It's mainly the stuff in qutebrowser/javascript and qutebrowser/html - though some of it needs to be rendered via jinja to (hopefully) be valid

@neeasade
Copy link
Contributor

Alright, so this would be in a new test file and I could use the jinja_test for reference on rendering to test?

@The-Compiler
Copy link
Member Author

I don't think the jinja tests help much here - you'd have a custom jinja2.Environment for the tests (take a look at unit/javascript/conftest.py maybe, which does something similar) and then render the templates with some dummy values.

How are you planning to do the validation though?

@neeasade
Copy link
Contributor

I was going to look into using py_w3c

@The-Compiler
Copy link
Member Author

This uses the network unfortunately, but I think it's the best solution - maybe you could take a look at the other solutions in my original post as well? It'd be nice to have something to run offline automated, and then the W3C validator e.g. manually

@neeasade
Copy link
Contributor

irc snippet for posterity

    neeasade │ The-Compiler: when you say manually on the w3c    
             │ validator, you mean the w3c validator offline?
The-Compiler │ neeasade: the issue is that I sometimes push a dozen
             │ times per day, so it'd be nice to have something which
             │ runs offline to always run with the automated checks
    neeasade │ The-Compiler: yeah I understand - I didn't consider
             │ that when I first posted                                 
The-Compiler │ and then something using W3C via the network only when
             │ there actually was a .html modified, or by hand from
             │ time to time
    neeasade │ ahhhh okay :)
    neeasade │ I will look more into the other links from OP
    neeasade │ at a glancepy_w3c looked most convienent (aside from
             │ network)
The-Compiler │ I imagine it with a parametrized pytest fixture, which
             │ checks a HTML via various ways, and skips w3c unless
             │ some commandline arg was given
The-Compiler │ I wonder if this is a good issue for you to work on,
             │ though - I have some ideas how to make it work, and
             │ some of the work also is integrating it with the CI
    neeasade │ I will likely be skimming the easy tagged issues before
             │ I do anything with this, I was curious about it

@The-Compiler The-Compiler added the priority: 2 - low Issues which are currently not very important. label Oct 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tests Issues related to the testsuite. priority: 2 - low Issues which are currently not very important.
Projects
None yet
Development

No branches or pull requests

2 participants