diff options
Diffstat (limited to 'addon-sdk/source/python-lib/cuddlefish/tests/__init__.py')
-rw-r--r-- | addon-sdk/source/python-lib/cuddlefish/tests/__init__.py | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/__init__.py b/addon-sdk/source/python-lib/cuddlefish/tests/__init__.py deleted file mode 100644 index 60e7e88b3..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/__init__.py +++ /dev/null @@ -1,52 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import os -import unittest -import doctest -import glob - -env_root = os.environ['CUDDLEFISH_ROOT'] - -def get_tests(): - import cuddlefish - import cuddlefish.tests - - tests = [] - packages = [cuddlefish, cuddlefish.tests] - for package in packages: - path = os.path.abspath(package.__path__[0]) - pynames = glob.glob(os.path.join(path, '*.py')) - for filename in pynames: - basename = os.path.basename(filename) - module_name = os.path.splitext(basename)[0] - full_name = "%s.%s" % (package.__name__, module_name) - module = __import__(full_name, fromlist=[package.__name__]) - - loader = unittest.TestLoader() - suite = loader.loadTestsFromModule(module) - for test in suite: - tests.append(test) - - finder = doctest.DocTestFinder() - doctests = finder.find(module) - for test in doctests: - if len(test.examples) > 0: - tests.append(doctest.DocTestCase(test)) - - return tests - -def run(verbose=False): - if verbose: - verbosity = 2 - else: - verbosity = 1 - - tests = get_tests() - suite = unittest.TestSuite(tests) - runner = unittest.TextTestRunner(verbosity=verbosity) - return runner.run(suite) - -if __name__ == '__main__': - run() |