Beispiel #1
0
def pytest_unconfigure(config):

    # If at least one figure test has been run, print result image directory
    if len(new_hash_library) > 0:
        # Write the new hash library in JSON
        figure_base_dir = pathlib.Path(config.getoption("--figure_dir"))
        hashfile = figure_base_dir / HASH_LIBRARY_NAME
        with open(hashfile, 'w') as outfile:
            json.dump(new_hash_library, outfile, sort_keys=True, indent=4, separators=(',', ': '))

        """
        Turn on internet when generating the figure comparison webpage.
        """
        if HAVE_REMOTEDATA:
            from pytest_remotedata.disable_internet import turn_on_internet, turn_off_internet
        else:
            def turn_on_internet(): pass
            def turn_off_internet(): pass

        turn_on_internet()
        generate_figure_webpage(new_hash_library)
        turn_off_internet()

        print('All images from image tests can be found in {0}'.format(figure_base_dir.resolve()))
        print("The corresponding hash library is {0}".format(hashfile.resolve()))
Beispiel #2
0
def pytest_unconfigure(config):

    # If at least one figure test has been run, print result image directory
    if len(new_hash_library) > 0:
        # Write the new hash library in JSON
        figure_base_dir = pathlib.Path(config.getoption("--figure_dir"))
        hashfile = figure_base_dir / HASH_LIBRARY_NAME
        with open(hashfile, 'w') as outfile:
            json.dump(new_hash_library,
                      outfile,
                      sort_keys=True,
                      indent=4,
                      separators=(',', ': '))
        """
        Turn on internet when generating the figure comparison webpage.
        """
        if HAVE_REMOTEDATA:
            from pytest_remotedata.disable_internet import turn_on_internet, turn_off_internet
        else:

            def turn_on_internet():
                pass

            def turn_off_internet():
                pass

        turn_on_internet()
        generate_figure_webpage(new_hash_library)
        turn_off_internet()

        print('All images from image tests can be found in {0}'.format(
            figure_base_dir))
        print("The corresponding hash library is {0}".format(hashfile))
Beispiel #3
0
def pytest_unconfigure(config):
    # If at least one figure test has been run, print result image directory
    if len(new_hash_library) > 0:
        # Write the new hash library in JSON
        figure_base_dir = pathlib.Path(config.getoption("--figure_dir"))
        hashfile = figure_base_dir / HASH_LIBRARY_NAME
        with open(hashfile, 'w') as outfile:
            json.dump(new_hash_library, outfile, sort_keys=True, indent=4, separators=(',', ': '))

        generate_figure_webpage()
        print('All images from image tests can be found in {0}'.format(figure_base_dir))
        print("The corresponding hash library is {0}".format(hashfile))