How to use the area4.Area4Instance function in area4

To help you get started, we’ve selected a few area4 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github area4lib / area4 / code_tests.py View on Github external
else:
    # If this is being run directly, set up for tests:
    debug("Module being run directly, not exiting")
    # Get working directory:
    debug("Getting working directory")
    WORKING_DIRECTORY = os.getenv("CIRRUS_WORKING_DIR")
    debug("Got working directory ({0})".format(WORKING_DIRECTORY))
    # Get divider text file:
    DIVIDERS_FILE = "{0}/{1}".format(WORKING_DIRECTORY, "area4/dividers.txt")
    debug("Divider file is located at {0}".format(DIVIDERS_FILE))
    with open(DIVIDERS_FILE, mode="r") as fh:
        RAW_DIVIDERS = fh.readlines()
        debug("Fetched raw dividers text file")
    # Create instance:
    debug("Creating instance of the library")
    D = area4.Area4Instance()
    debug("Created instance")

    # See if we need to run extra tests:
    if ("!e" in COMMIT_MESSAGE or COMMIT_MESSAGE == "!e") or \
            (REPO_BRANCH == "master"):
        debug("Running extra tests")
        EXTRA_TESTS = True
    else:
        EXTRA_TESTS = False


def test_dividers():
    """
    Test each divider against the raw ones from the text file.

    :return: None