This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
carboncopy/tasks.py
Marc Cataford c647f9dbd9
Test coverage pt.1 (#4)
* test: config fetch coverage

* ci: add test runner

* test: add test stubs

* chore: move twine and wheel to bootstrap

* infra: add test inv

* refactor: review for testability

* test: use case testing
2020-01-06 23:00:22 -05:00

41 lines
699 B
Python

from invoke import Collection, task
TMP_PATH = "/tmp/carboncopy_pytest/"
@task
def format_all(ctx):
ctx.run("black src *.py")
@task
def typecheck(ctx):
ctx.run("mypy src")
@task
def package(ctx):
ctx.run("rm -rf dist && python setup.py sdist bdist_wheel")
@task(optional=["test"])
def publish(ctx, test=False):
if test:
ctx.run(
"twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/*"
)
else:
ctx.run("twine upload dist/*")
@task
def test(ctx):
ctx.run("pytest")
ns = Collection()
ns.add_task(format_all, name="format")
ns.add_task(typecheck)
ns.add_task(package)
ns.add_task(publish)
ns.add_task(test)