Commits

Gael Pasgrimaud committed f076d69

allow to test with a test runner

Comments (0)

Files changed (3)

pyquery/README.txt

     >>> from pyquery import PyQuery
     >>> d = PyQuery(html="<html></html>")
     >>> d = PyQuery(url='http://w3c.org/')
-    >>> d = PyQuery(filename="test.html")
+    >>> d = PyQuery(filename=path_to_html_file)
 
 Now d is like the $ in jquery::
 
 # Copyright (C) 2008 - Olivier Lauzanne <olauzanne@gmail.com>
 #
 # Distributed under the BSD license, see LICENSE.txt
+import doctest
+import os
 
-def test():
-    import doctest
-    doctest.testfile('README.txt', optionflags=doctest.ELLIPSIS)
+dirname = os.path.dirname(__file__)
+path_to_html_file = open(os.path.join(dirname, 'test.html'))
+
+def test_docs():
+    doctest.testfile('README.txt', globs=globals(),
+                     optionflags=doctest.ELLIPSIS)
 
 if __name__ == '__main__':
-    test()
+    test_docs()
 [nosetests]
 with-doctest=true
-doctest-extension=.txt