Esempio n. 1
0
def remove_cd():
    """
    Remove file in current directory.
    """

    with pun.cd('./tests'):
        pun.run('rm file')
Esempio n. 2
0
def environ():
    """
    Print env.
    """

    with pun.env('pun_env', 34):
        pun.run(print, os.environ['pun_env'])
Esempio n. 3
0
def touch_cd():
    """
    Create file in current directory.
    """

    with pun.cd('./tests'):
        pun.run('touch file')
Esempio n. 4
0
def run():
    """
    Run server
    """

    webbrowser.open("http://127.0.0.1:5000")
    pun.run('flask run -h 0.0.0.0')
Esempio n. 5
0
def init():
    """
    Create an empty punfile.
    """

    pun.run('touch punfile.py')
    with open('punfile.py', 'w') as fp:
        fp.write(init_template)
Esempio n. 6
0
def clean_build():
    """
    Remove build artifacts.
    """

    pun.run("rm -fr build/")
    pun.run("rm -fr dist/")
    pun.run("rm -fr .eggs/")
    pun.run("find . -name '*.egg-info' -exec rm -fr {} +")
    pun.run("find . -name '*.egg' -exec rm -f {} +")
Esempio n. 7
0
def help(punned):
    """
    Show list of task and their description.
    """

    # make default to None for printing helper
    default = punned.default
    punned.default = None

    pun.run(punned.run)

    punned.default = default
Esempio n. 8
0
def clean_pyc():
    """
    Remove Python file artifacts.
    """

    pun.run("find . -name '*.pyc' -exec rm -f {} +")
    pun.run("find . -name '*.pyo' -exec rm -f {} +")
    pun.run("find . -name '*~' -exec rm -f {} +")
    pun.run("find . -name '__pycache__' -exec rm -fr {} +")
Esempio n. 9
0
def clean_test():
    """
    Remove test and coverage artifacts.
    """

    pun.run("rm -fr .tox/")
    pun.run("rm -f .coverage")
    pun.run("rm -fr htmlcov/")
    pun.run("rm -fr .pytest_cache")
Esempio n. 10
0
def coverage():
    """
    Check code coverage quickly with the default Python.
    """

    pun.run("coverage run --source pun -m pytest")
    pun.run("coverage report -m")
    pun.run("coverage html")
    pun.run(browser, "htmlcov/index.html")
Esempio n. 11
0
def dist():
    """
    Builds source and wheel package.
    """

    pun.run("python setup.py sdist")
    pun.run("python setup.py bdist_wheel")
    pun.run("ls -l dist")
Esempio n. 12
0
def docs():
    """
    Generate Sphinx HTML documentation, including API docs.
    """

    pun.run("rm -f docs/pun.rst")
    pun.run("rm -f docs/modules.rst")
    pun.run("sphinx-apidoc -o docs/ pun")

    with pun.cd('./docs'):
        pun.run("make clean")
        pun.run("make html")

    pun.run(browser, "docs/_build/html/index.html")
Esempio n. 13
0
def option():
    """
    Called with --option
    """

    pun.run(print, 'optioned')
Esempio n. 14
0
def release():
    """
    Package and upload a release.
    """

    pun.run('twine upload dist/*')
Esempio n. 15
0
def touch():
    """
    Create file in current directory.
    """

    pun.run('touch file')
Esempio n. 16
0
def test():
    """
    Run tests quickly with the default Python.
    """

    pun.run('pytest')
Esempio n. 17
0
def need_fixture3(one, two, three):
    """
    This task need three fixture.
    """

    pun.run(print, one() + two() + three())
Esempio n. 18
0
def version():
    """
    Show pun version.
    """

    pun.run(print, f'pun version {pun.__version__}')
Esempio n. 19
0
def need_fixture1(one):
    """
    This task need one fixture.
    """

    pun.run(print, one())
Esempio n. 20
0
def default():
    """
    This should executed when no arg.
    """

    pun.run('echo default')
Esempio n. 21
0
def install():
    """
    Install the package to the active Python's site-packages.
    """

    pun.run('pip install .')
Esempio n. 22
0
def remove():
    """
    Remove file in current directory.
    """

    pun.run('rm file')
Esempio n. 23
0
def need_fixture4(one, two, three, four):
    """
    This task need three fixture.
    """

    pun.run(print, one() + two() + three() + four())
Esempio n. 24
0
def lint():
    """
    Check style with flake8.
    """

    pun.run('flake8 pun tests')
Esempio n. 25
0
def no_fixture(undefined):
    """
    Fail because no fixture named 'undefined'.
    """

    pun.run(print, undefined())
Esempio n. 26
0
def test_all():
    """
    Run tests on every Python version with tox.
    """

    pun.run('tox')
Esempio n. 27
0
def punned_fixture(punned):
    """
    Fail because no fixture named 'undefined'.
    """

    pun.run(print, punned)
Esempio n. 28
0
def need_fixture2(one, two):
    """
    This task need two fixture.
    """

    pun.run(print, one() + two())
Esempio n. 29
0
def install_dev():
    """
    Install the package for development.
    """

    pun.run('pip install -e .')