diff options
author | Chayim <chayim@users.noreply.github.com> | 2021-10-21 08:55:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-21 08:55:32 +0300 |
commit | 63ebe693174a4e6ec314e48d12fcdf3f8401eec6 (patch) | |
tree | e1cc497709a49bf6b448cfe8d9fed971f2036f80 /tasks.py | |
parent | e60d97e6f428f4c536324922ebbe7efcd2440b83 (diff) | |
download | redis-py-63ebe693174a4e6ec314e48d12fcdf3f8401eec6.tar.gz |
tox integrations with invoke and docker (#1632)
Diffstat (limited to 'tasks.py')
-rw-r--r-- | tasks.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tasks.py b/tasks.py new file mode 100644 index 0000000..15e983b --- /dev/null +++ b/tasks.py @@ -0,0 +1,60 @@ +import os +import shutil +from invoke import task, run + +with open('tox.ini') as fp: + lines = fp.read().split("\n") + dockers = [line.split("=")[1].strip() for line in lines + if line.find("name") != -1] + + +@task +def devenv(c): + """Builds a development environment: downloads, and starts all dockers + specified in the tox.ini file. + """ + clean(c) + cmd = 'tox -e devenv' + for d in dockers: + cmd += " --docker-dont-stop={}".format(d) + print("Running: {}".format(cmd)) + run(cmd) + + +@task +def linters(c): + """Run code linters""" + run("flake8") + + +@task +def all_tests(c): + """Run all linters, and tests in redis-py. This assumes you have all + the python versions specified in the tox.ini file. + """ + linters(c) + tests(c) + + +@task +def tests(c): + """Run the redis-py test suite against the current python, + with and without hiredis. + """ + run("tox -e plain -e hiredis") + + +@task +def clean(c): + """Stop all dockers, and clean up the built binaries, if generated.""" + if os.path.isdir("build"): + shutil.rmtree("build") + if os.path.isdir("dist"): + shutil.rmtree("dist") + run("docker rm -f {}".format(' '.join(dockers))) + + +@task +def package(c): + """Create the python packages""" + run("python setup.py build install") |