# Path: tasks/_config.py
# NAME = "imageio"
# DOC_DIR = op.join(ROOT_DIR, "docs")
# DOC_BUILD_DIR = op.join(DOC_DIR, "_build")


import os
import sys
import subprocess
import webbrowser
    import black
    import pytest
from invoke import task
from ._config import ROOT_DIR
    black_wrapper(False)  # always exits


@task(
    optional=["unit", "style"],
    help=dict(
        unit="run unit tests (pytest)",
        installed="like unit, but prefer using installed package, "
        + "and do not allow the use of internet.",
        style="run style tests (flake8 and black)",
        cover="show test coverage",
    ),
)
def test(ctx, unit=False, installed=False, style=False, cover=False):
    """run tests (unit, style)"""

    if not (unit or installed or style or cover):
        sys.exit("Test task needs --unit, --style or --cover")

    if unit:
        sys.exit(pytest_wrapper())

    if style:
        flake8_wrapper()  # exits on fail
        black_wrapper(False)  # always exits

    if installed:
        for p in list(sys.path):
            if p in ("", "."):
                sys.path.remove(p)

# Path: tasks/_config.py
# NAME = "imageio"
# DOC_DIR = op.join(ROOT_DIR, "docs")
# DOC_BUILD_DIR = op.join(DOC_DIR, "_build")


# Path: tasks/test.py
import os
import sys
import subprocess
import webbrowser
    import black
    import pytest
from invoke import task
from ._config import ROOT_DIR

    black_wrapper(False)  # always exits


@task(
    optional=["unit", "style"],
    help=dict(
        unit="run unit tests (pytest)",
        installed="like unit, but prefer using installed package, "
        + "and do not allow the use of internet.",
        style="run style tests (flake8 and black)",
        cover="show test coverage",
    ),
)
def test(ctx, unit=False, installed=False, style=False, cover=False):
    """run tests (unit, style)"""

    if not (unit or installed or style or cover):
        sys.exit("Test task needs --unit, --style or --cover")

    if unit:
        sys.exit(pytest_wrapper())

    if style:
        flake8_wrapper()  # exits on fail
        black_wrapper(False)  # always exits

    if installed:
        for p in list(sys.path):
            if p in ("", "."):
                sys.path.remove(p)

            elif p == ROOT_DIR or p == os.path.dirname(ROOT_DIR):