[Zope-dev] Adding W3C validating to zope.testbrowser

Ross Patterson me at rpatterson.net
Sun Feb 28 08:19:36 EST 2010


Benji York <benji at zope.com> writes:

> On Sat, Feb 20, 2010 at 7:53 AM, Ross Patterson <me at rpatterson.net> wrote:
>> I started a branch for doing W3C HTML validation on responses to
>> zope.testbrowser requests:
>>
>> svn://svn.zope.org/repos/main/zope.testbrowser/branches/rossp-validator
>>
>> The idea is to be able to flip a switch and run all my functional
>> zope.testbrowser tests and see validation failures as test failures.
>
> I'm not keen on this idea.  Validation checking isn't hard to do with
> testbrowser as-is, and doing it on every page load is overkill.  Add to
> that the global nature of the required switch and this really doesn't
> seem like the right approach.
>
> I suggest you create a package that subclasses testbrowser to provide
> the behavior you want.  Perhaps if it is widely adopted and the approach
> proves itself, it can be rolled in.

This means I wouldn't be able to run *existing* functional tests as a
validation check.  Since many packages include functional tests that
*already* exercise the HTML generation in the application, I want to use
them to validate the HTML.  You're right that validation checking isn't
hard to do with testbrowser as-is if you're trying to write tests
*dedicated* to having coverage for your HTML validity.  So I don't think
the testbrowser subclass approach is very valuable at all.

>> Does this belong in zope.testbrowser or in the underlying mechanize
>> package?
>
> It appears to me to belong higher in the stack, not lower.
>
> I do like the local validator approach.  How will you manage that
> dependency?

Since Ubuntu/Debian have a nice package for installing the the W3C
cgi-bin/check Perl script and configuring my local system apache, I just
used that and use http://localhost/cgi-bin/check.  The current
zope.testbrowser patch checks the aforementioned environment variable
for the URL to use to validate, so that's how the user would specify not
only to do the validation but where to send the validation re1quests to.

I spent a bit of time trying to figure out how to get Python to invoke
the W3C cgi-bin/check Perl script directly so I could just include it in
the package, but it was taking too long.  Do you have any idea how I can
setup enough environment to directly call a cgi-bin script directly with
subprocess?

Other wise I suppose I'll have to manage the dependency in
documentation, "ensure you have the W3C validator available at a URL.  I
recommend installing it locally following the instructions at...".

Any other options from anyone else.

Ross



More information about the Zope-Dev mailing list