Webware / AllTests.py

#!/usr/bin/env python

"""AllTests.py - This module runs the automated tests in all the components.

To run specific test cases, pass one or more names of package/module names
on the command line which contain the test cases to be run.

    python AllTests.py                  - Runs all the unittests
    python AllTests.py mypackage.MyFile - Runs the tests in 'mypackage/MyFile'


alltestnames = [








import site
import sys
import unittest
import logging

if __name__ == '__main__':
    # Configure logging
    logging.basicConfig() # default level is WARN
    # If no arguments are given, all of the test cases are run.
    if len(sys.argv) == 1:
        testnames = alltestnames
        verbosity = 2
        print 'Loading all Webware Tests...'
        testnames = sys.argv[1:]
        # Turn up verbosity and logging level
        verbosity = 3
        print 'Loading tests %s...' % testnames

    tests = unittest.TestSuite()

    # We could just use defaultTestLoader.loadTestsFromNames(),
    # but it doesn't give a good error message when it cannot load a test.
    # So we load all tests individually and raise appropriate exceptions.
    for test in testnames:
        except Exception:
            print 'ERROR: Skipping tests from "%s".' % test
            try: # just try to import the test after loadig failed
            except ImportError:
                print 'Could not import the test module.'
                print 'Could not load the test suite.'
            from traceback import print_exc

    print 'Running the tests...'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.