subunit: extensions to python unittest to get test results from subprocesses. Copyright (C) 2005 Robert Collins This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Subunit is attempting to extend unittest with a clean and simple api to run arbitrary external test suites and return the results to standard python unittest. Some requirements: The shape of the external unittest should not need to be known a-priori. After the test has run, tests should still exist as discrete objects, so that anything taking a reference to them doesn't get 50 copies of the same object. TEST: test foo works SUCCESS: test foo works. TEST: tar a file. FAILURE: tar a file. [ .. ].. space is eaten. foo.c:34 WARNING foo is not defined. ] a writeln to stdout =========== .F a writeln to stdout ======================== FAILURE: tar a file. ------------------- .. ].. space is eatern. foo.c:34 WARNING foo is not defined. ======================== control protocol: test|testing|test:|testing: test label success|success:|successful|successful: test label failure test label failure: test label failure test label [ ... ] failure: test label [ ... ] error: test label error: test label [ ] unexpected output on stdout -> stdout. exit w/0 or last test -> error rough structure of the server: SubprocessTestCase(unittest.TestCase): def run: do a fork, this process runs server child runs client and calls self.run() with a SubprocessTestResult developing - write a server and feed it chosen strings DONE. a mock child process etc. write a client and check the right things come back for the various permutations check that stdout output in the client is passed to the real stdout.