Ejemplo n.º 1
0
    def run_tests(self):
        import matplotlib
        matplotlib.use('agg')
        import nose
        from matplotlib.testing.noseclasses import KnownFailure
        from matplotlib import default_test_modules as testmodules
        from matplotlib import font_manager
        import time
        # Make sure the font caches are created before starting any possibly
        # parallel tests
        if font_manager._fmcache is not None:
            while not os.path.exists(font_manager._fmcache):
                time.sleep(0.5)
        plugins = [KnownFailure]

        # Nose doesn't automatically instantiate all of the plugins in the
        # child processes, so we have to provide the multiprocess plugin
        # with a list.
        from nose.plugins import multiprocess
        multiprocess._instantiate_plugins = plugins

        if self.omit_pep8:
            testmodules.remove('matplotlib.tests.test_coding_standards')
        elif self.pep8_only:
            testmodules = ['matplotlib.tests.test_coding_standards']

        nose.main(addplugins=[x() for x in plugins],
                  defaultTest=testmodules,
                  argv=['nosetests'] + self.test_args,
                  exit=True)
Ejemplo n.º 2
0
def pytest_configure(config):
    matplotlib._called_from_pytest = True
    matplotlib._init_tests()

    if config.getoption('--no-pep8'):
        default_test_modules.remove('matplotlib.tests.test_coding_standards')
        IGNORED_TESTS['matplotlib'] += 'test_coding_standards'
Ejemplo n.º 3
0
    def run_tests(self):
        import matplotlib
        matplotlib.use('agg')
        import nose
        from matplotlib.testing.noseclasses import KnownFailure
        from matplotlib import default_test_modules as testmodules
        from matplotlib import font_manager
        import time
        # Make sure the font caches are created before starting any possibly
        # parallel tests
        if font_manager._fmcache is not None:
            while not os.path.exists(font_manager._fmcache):
                time.sleep(0.5)
        plugins = [KnownFailure]

        # Nose doesn't automatically instantiate all of the plugins in the
        # child processes, so we have to provide the multiprocess plugin
        # with a list.
        from nose.plugins import multiprocess
        multiprocess._instantiate_plugins = plugins

        if self.omit_pep8:
            testmodules.remove('matplotlib.tests.test_coding_standards')
        elif self.pep8_only:
            testmodules = ['matplotlib.tests.test_coding_standards']

        nose.main(addplugins=[x() for x in plugins],
                  defaultTest=testmodules,
                  argv=['nosetests'] + self.test_args,
                  exit=True)
Ejemplo n.º 4
0
def pytest_configure(config):
    matplotlib._called_from_pytest = True
    matplotlib._init_tests()

    if config.getoption('--no-pep8'):
        default_test_modules.remove('matplotlib.tests.test_coding_standards')
        IGNORED_TESTS['matplotlib'] += 'test_coding_standards'
Ejemplo n.º 5
0
    def run_tests(self):
        try:
            import matplotlib
            matplotlib.use('agg')
            import nose
            from matplotlib.testing.noseclasses import KnownFailure
            from matplotlib import default_test_modules
            from matplotlib import font_manager
            import time
            # Make sure the font caches are created before starting any possibly
            # parallel tests
            if font_manager._fmcache is not None:
                while not os.path.exists(font_manager._fmcache):
                    time.sleep(0.5)
            plugins = [KnownFailure]

            # Nose doesn't automatically instantiate all of the plugins in the
            # child processes, so we have to provide the multiprocess plugin
            # with a list.
            from nose.plugins import multiprocess
            multiprocess._instantiate_plugins = plugins

            if '--no-pep8' in sys.argv:
                default_test_modules.remove('matplotlib.tests.test_coding_standards')
                sys.argv.remove('--no-pep8')
            elif '--pep8' in sys.argv:
                default_test_modules = ['matplotlib.tests.test_coding_standards']
                sys.argv.remove('--pep8')
            nose.main(addplugins=[x() for x in plugins],
                      defaultTest=default_test_modules,
                      argv=['nosetests'],
                      exit=False)
        except ImportError:
            sys.exit(-1)
Ejemplo n.º 6
0
                        action='store_true',
                        help='Run all tests except PEP8 testing')
    parser.add_argument('--pep8',
                        action='store_true',
                        help='Run only PEP8 testing')
    parser.add_argument('--no-network',
                        action='store_true',
                        help='Run tests without network connection')
    parser.add_argument(
        '-j',
        type=int,
        help='Shortcut for specifying number of test processes')
    args, extra_args = parser.parse_known_args()

    if args.no_pep8:
        default_test_modules.remove('matplotlib.tests.test_coding_standards')
        sys.argv.remove('--no-pep8')
    elif args.pep8:
        default_test_modules[:] = ['matplotlib.tests.test_coding_standards']
        sys.argv.remove('--pep8')
    if args.no_network:
        from matplotlib.testing import disable_internet
        disable_internet.turn_off_internet()
        extra_args.extend(['-a', '!network'])
        sys.argv.remove('--no-network')
    if args.j:
        extra_args.extend(
            ['--processes={}'.format(args.j), '--process-timeout=300'])
        sys.argv.pop(sys.argv.index('-j') + 1)
        sys.argv.remove('-j')
Ejemplo n.º 7
0
if __name__ == '__main__':
    from matplotlib import default_test_modules, test

    parser = argparse.ArgumentParser(add_help=False)
    parser.add_argument('--no-pep8', action='store_true',
                        help='Run all tests except PEP8 testing')
    parser.add_argument('--pep8', action='store_true',
                        help='Run only PEP8 testing')
    parser.add_argument('--no-network', action='store_true',
                        help='Run tests without network connection')
    parser.add_argument('-j', type=int,
                        help='Shortcut for specifying number of test processes')
    args, extra_args = parser.parse_known_args()

    if args.no_pep8:
        default_test_modules.remove('matplotlib.tests.test_coding_standards')
        sys.argv.remove('--no-pep8')
    elif args.pep8:
        default_test_modules[:] = ['matplotlib.tests.test_coding_standards']
        sys.argv.remove('--pep8')
    if args.no_network:
        from matplotlib.testing import disable_internet
        disable_internet.turn_off_internet()
        extra_args.extend(['-a', '!network'])
        sys.argv.remove('--no-network')
    if args.j:
        extra_args.extend([
            '--processes={}'.format(args.j),
            '--process-timeout=300'
        ])
        sys.argv.pop(sys.argv.index('-j') + 1)