Commits

masklinn committed 49ac629

Add info to readme

  • Participants
  • Parent commits d921101

Comments (0)

Files changed (2)

 Why
 ---
 
+You're a Python shop or developer, you have tools and tests built
+around unittest (or compatible with unittests) and your testing
+pipeline is predicated upon that, you're doing web development of some
+sort these days (as so many are) and you'd like to do some testing of
+your web stuff.
+
+But you don't really want to redo your whole testing stack just for
+that.
+
+QUnitSuite simply grafts QUnit_-based tests, run in PhantomJS_, in
+your existing ``unittest``-based architecture.
+
 What
 ----
 
+QUnitSuite currently provides a single object as part of its API:
+``qunitsuite.QUnitSuite(testfile[, timeout])``.
+
+This produces a ``unittest.TestSuite`` suitable for all the usual
+stuff (running it, and giving it to an other test suite which will run
+it, that is).
+
+``testfile`` is the HTML file bootstrapping your qunit tests, as would
+usually be accessed via a browser. It can be either a local
+(``file:``) url, or an HTTP one. As long as a regular browser can open
+and execute it, PhantomJS_ will manage.
+
+``timeout`` is a check passed to the PhantomJS_ runner: if the runner
+produces no information for longer than ``timeout`` milliseconds, the
+run will be cancelled and a test error will be generated. This
+situation usually means either your ``testfile`` is not a qunit test
+file, qunit is not running or qunit's runner was stopped (for an async
+test) and never restarted.
+
+The default value is very conservative, most tests should run
+correctly with lower timeouts (especially if all tests are
+synchronous).
+
 How
 ---
 
 ``unittest``'s autodiscovery protocol does not directly work with test
 suites (it looks for test cases). If you want autodiscovery to work
-correctly, you will have to use the ``load_tests`` protocol:
-
-.. code::
+correctly, you will have to use the ``load_tests`` protocol::
 
     # in a testing module
     def load_tests(loader, tests, pattern):

File qunitsuite/suite.py

 import json
 import subprocess
-import tempfile
 import unittest
 import os
 import time