1
0
Fork 0

Added coverage support for functional tests.

This commit is contained in:
Irina Truong 2017-03-19 17:19:39 -07:00
parent 5fdcb889bd
commit 4aea9015aa
4 changed files with 11 additions and 2 deletions

3
.coveragerc Normal file
View File

@ -0,0 +1,3 @@
[run]
parallel=True
source=pgcli

View File

@ -3,3 +3,4 @@ mock>=1.0.1
tox>=1.9.2
behave>=1.2.4
pexpect==3.3
coverage==4.3.4

View File

@ -16,6 +16,7 @@ def before_all(context):
os.environ['COLUMNS'] = "100"
os.environ['PAGER'] = 'cat'
os.environ['EDITOR'] = 'nano'
os.environ["COVERAGE_PROCESS_START"] = os.getcwd() + "/../.coveragerc"
context.exit_sent = False
@ -30,7 +31,10 @@ def before_all(context):
'pass': context.config.userdata.get('pg_test_pass', None),
'dbname': db_name_full,
'dbname_tmp': db_name_full + '_tmp',
'vi': vi
'vi': vi,
'cli_command': context.config.userdata.get('pg_cli_command', None) or
sys.executable +
' -c "import coverage; coverage.process_startup(); import pgcli.main; pgcli.main.cli()"'
}
# Store old env vars.

View File

@ -17,7 +17,8 @@ def step_run_cli(context):
"""
Run the process using pexpect.
"""
context.cli = pexpect.spawnu('pgcli')
cli_cmd = context.conf.get('cli_command')
context.cli = pexpect.spawnu(cli_cmd)
context.exit_sent = False