takluyver/pyxdg — pull request #6 by ju1ius (2013-12-05 10:13:57+00:00)
Title: Added script for running freedesktop.org test suite...

...and some fixes to make it look more green.

You can run it this way:
```sh
# Install the test suite somewhere
$ git clone git://anongit.freedesktop.org/xdg/xdg-specs
$ cd xdg-specs/menu/tests
# run the full suite
$ MENUTEST="/path/to/pyxdg/test/menu-spec/menutest.py" ./menutest
# tests can be run individually
$ MENUTEST="/path/to/pyxdg/test/menu-spec/menutest.py" TESTS="AppDir" ./menutest
```
The test suite generates a fake environment for each test, in `$MENUTESTDIR`, which defaults to `/tmp/menutestdir/`.
The script's stderr is sent to `$MENUTESTDIR/log`, stdout to `$MENUTESTDIR/run-result`, which is then compared to `$MENUTESTDIR/required-result`.

Now it would be nicer if the test suite was written in Python, but it would take quite a bit of work to convert those cryptic bashisms...

Notes:
* four tests (AppDir, DirectoryDir, MergeDir-absolute, MergeFile-absolute) don't pass because they are not yet implemented
* The "official-categories" test passes only if an applications.menu is installed and it supports the 10 standard categories
* The "MergeFile-recursive" test will fail is the debug flag of XMLMenuBuilder is set to True. This test generates an infinite merge loop, which raises a ParsingError in debug mode.

Cheers ! :-)