Debian Codegraph @

tasks/__behave.py

raw
1 # -*- coding: UTF-8 -*-
2 """
3 Invoke build script (python based).
4
5 .. seealso:: https://github.com/pyinvoke/invoke
6 """
7
8 from __future__ import print_function
9 import sys
10 from invoke import task, Collection
11
12 # USE_PTY = os.isatty(sys.stdout)
13 USE_PTY = sys.stdout.isatty()
14
15 # ---------------------------------------------------------------------------
16 # TASKS
17 # ---------------------------------------------------------------------------
18 # MAYBE: echo=False):
19 @task(help={
20 "args": "Command line args for behave",
21 "format": "Formatter to use",
22 })
23 def behave_test(ctx, args="", format=""): # pylint: disable=redefined-builtin
24 """Run behave tests."""
25 format = format or ctx.behave_test.format
26 options = ctx.behave_test.options or ""
27 args = args or ctx.behave_test.args
28 behave = "{python} bin/behave".format(python=sys.executable)
29 ctx.run("{behave} -f {format} {options} {args}".format(
30 behave=behave, format=format, options=options, args=args), pty=USE_PTY)
31
32
33 # ---------------------------------------------------------------------------
34 # TASK MANAGEMENT / CONFIGURATION
35 # ---------------------------------------------------------------------------
36 # namespace.add_task(behave_test, default=True)
37 namespace = Collection()
38 namespace.add_task(behave_test, default=True)
39 namespace.configure({
40 "behave_test": {
41 "args": "",
42 "format": "progress2",
43 "options": "", # -- NOTE: Overide in configfile "invoke.yaml"
44 },
45 })