Beispiel #1
0
def runtests():
    global quick
    global modules
    global verbose
    global windows
    result = doctest_modules(modules, verbose=verbose)
    if not quick:
        print()
        # No idea why we mess and set snappy.database.Manifold
        # to SnapPy.Manifold above... But to make ptolemy work,
        # temporarily setting it to what it should be.
        original_db_manifold = snappy.database.Manifold
        snappy.database.Manifold = snappy.Manifold
        snappy.ptolemy.test.main(verbose=verbose, doctest=False)
        snappy.database.Manifold = original_db_manifold
        print()
        spherogram.links.test.run()
    print('\nAll doctests:\n   %s failures out of %s tests.' % result)
    if cyopengl_works() and root_is_fake():
        root = tk_root()
        if root:
            if windows:
                print('Close the root window to finish.')
            else:
                print('The windows will close in a few seconds.\n'
                      'Specify -w or --windows to avoid this.')
                root.after(7000, root.destroy)
            root.mainloop()
    return result.failed
Beispiel #2
0
def graphics_failures(verbose):
    if cyopengl_works():
        print("Testing graphics ...")
        import snappy.CyOpenGL
        result = doctest_modules([snappy.CyOpenGL], verbose=verbose).failed
        snappy.Manifold('m004').dirichlet_domain().view().test()
        snappy.Manifold('m125').cusp_neighborhood().view().test()
        if use_modernopengl:
            snappy.Manifold('m004').inside_view().test()
        snappy.Manifold('4_1').browse().test()
        snappy.ManifoldHP('m004').dirichlet_domain().view().test()
        snappy.ManifoldHP('m125').cusp_neighborhood().view().test()
        if use_modernopengl:
            snappy.ManifoldHP('m004').inside_view().test()
        if root_is_fake():
            root = tk_root()
            if root:
                if windows:
                    print('Close the root window to finish.')
                else:
                    print('The windows will close in a few seconds.\n'
                          'Specify -w or --windows to avoid this.')
                    root.after(7000, root.destroy)
                root.mainloop()
    else:
        print("***Warning***: CyOpenGL not installed, so not tested")
        result = 0
    return result
Beispiel #3
0
def ptolemy_doctester(verbose):
    return snappy.ptolemy.test.run_doctests(verbose, print_info=False)
ptolemy_doctester.__name__ = 'snappy.ptolemy'

try:
    optlist, args = getopt.getopt(sys.argv[1:], 'ivqw',
                                  ['ignore', 'verbose', 'quick', 'windows'])
    opts = [o[0] for o in optlist]
    verbose = '-v' in opts or '--verbose' in opts
    quick = '-q' in opts or '--quick' in opts
    windows = '-w' in opts or '--windows' in opts
except getopt.GetoptError:
    verbose, quick, windows = False, False, False

if cyopengl_works():
    import snappy.CyOpenGL
    modules = [snappy.CyOpenGL]
else:
    print("***Warning***: CyOpenGL not installed, so not tested")
    modules = []

modules += [numeric_output_checker.run_doctests]
modules += [snappy.SnapPy, snappy.SnapPyHP, snappy.database, snappy_doctester,
            snap_doctester, ptolemy_doctester, spherogram_doctester]

if _within_sage:
    def snappy_verify_doctester(verbose):
        use_sage_field_conversion()
        ans = snappy.verify.test.run_doctests(verbose, print_info=False)
        use_snappy_field_conversion()