Default unit test session.

    This is intended to be run **without** an interpreter set, so
    that the current ``python`` (on the ``PATH``) or the version of
    Python corresponding to the ``nox`` binary the ``PATH`` can
    run the tests.

def default(session):
    """Default unit test session.

    This is intended to be run **without** an interpreter set, so
    that the current ``python`` (on the ``PATH``) or the version of
    Python corresponding to the ``nox`` binary the ``PATH`` can
    run the tests.
    """
    # Install all test dependencies, then install local packages in-place.
    session.install("mock", "pytest", "pytest-cov")
    for local_dep in LOCAL_DEPS:
        session.install("-e", local_dep)

    # Pyarrow does not support Python 3.7
    dev_install = ".[all]"
    session.install("-e", dev_install)

    # IPython does not support Python 2 after version 5.x
    if session.python == "2.7":
        session.install("ipython==5.5")
    else:
        session.install("ipython")

    # Run py.test against the unit tests.
    session.run(
        "py.test",
        "--quiet",
        "--cov=google.cloud.bigquery",
        "--cov=tests.unit",
        "--cov-append",
        "--cov-config=.coveragerc",
        "--cov-report=",
        "--cov-fail-under=97",
        os.path.join("tests", "unit"),
        *session.posargs
    )