mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-19 06:43:06 +02:00
test: Add conditional coverage measurement
This commit is contained in:
parent
3aaafaa418
commit
26f23ce5f9
2 changed files with 17 additions and 1 deletions
|
@ -3,6 +3,21 @@ import itertools
|
|||
import sys
|
||||
import vim # pylint: disable=F0401
|
||||
|
||||
# Start measuring coverage if in testing
|
||||
if vim.vars.get('taskwiki_measure_coverage'):
|
||||
import os
|
||||
import atexit
|
||||
import coverage
|
||||
coverage_path = os.path.expanduser('~/taskwiki-coverage/.coverage.{0}'.format(os.getpid()))
|
||||
cov = coverage.coverage(data_file=coverage_path)
|
||||
cov.start()
|
||||
|
||||
def save_coverage():
|
||||
cov.stop()
|
||||
cov.save()
|
||||
|
||||
atexit.register(save_coverage)
|
||||
|
||||
from tasklib.task import TaskWarrior, Task
|
||||
|
||||
# Insert the taskwiki on the python path
|
||||
|
|
|
@ -39,9 +39,10 @@ class IntegrationTest(object):
|
|||
def setup(self):
|
||||
self.generate_data()
|
||||
self.client = server.start_gvim()
|
||||
self.command('let g:taskwiki_measure_coverage="yes"')
|
||||
self.command('let g:taskwiki_data_location="{0}"'.format(self.dir))
|
||||
self.add_plugin('taskwiki')
|
||||
self.add_plugin('vimwiki')
|
||||
self.command('let g:taskwiki_data_location="{0}"'.format(self.dir))
|
||||
self.client.edit(os.path.join(self.dir, 'testwiki.txt'))
|
||||
self.command('set filetype=vimwiki', silent=False) # TODO: fix these vimwiki loading errors
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue