예제 #1
0
def remove_cd():
    """
    Remove file in current directory.
    """

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

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

    with pun.cd('./tests'):
        pun.run('touch file')
예제 #4
0
def run():
    """
    Run server
    """

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

    pun.run('touch punfile.py')
    with open('punfile.py', 'w') as fp:
        fp.write(init_template)
예제 #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 {} +")
예제 #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
예제 #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 {} +")
예제 #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")
예제 #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")
예제 #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")
예제 #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")
예제 #13
0
def option():
    """
    Called with --option
    """

    pun.run(print, 'optioned')
예제 #14
0
def release():
    """
    Package and upload a release.
    """

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

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

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

    pun.run(print, one() + two() + three())
예제 #18
0
def version():
    """
    Show pun version.
    """

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

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

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

    pun.run('pip install .')
예제 #22
0
def remove():
    """
    Remove file in current directory.
    """

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

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

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

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

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

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

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

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