Skip coverage bits on < go1.2
This commit is contained in:
parent
b9f33fbe6d
commit
2df2fa514d
31
runtests
31
runtests
@ -5,7 +5,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from subprocess import check_call
|
from subprocess import check_call, check_output
|
||||||
|
|
||||||
|
|
||||||
PACKAGE_NAME = os.environ.get(
|
PACKAGE_NAME = os.environ.get(
|
||||||
@ -16,22 +16,25 @@ PACKAGE_NAME = os.environ.get(
|
|||||||
def main():
|
def main():
|
||||||
_run('go vet ./...'.split())
|
_run('go vet ./...'.split())
|
||||||
|
|
||||||
coverprofiles = []
|
if check_output('go version'.split()).split()[2] >= 'go1.2':
|
||||||
for subpackage in ['', 'altsrc']:
|
coverprofiles = []
|
||||||
coverprofile = 'cli.coverprofile'
|
for subpackage in ['', 'altsrc']:
|
||||||
if subpackage != '':
|
coverprofile = 'cli.coverprofile'
|
||||||
coverprofile = '{}.coverprofile'.format(subpackage)
|
if subpackage != '':
|
||||||
|
coverprofile = '{}.coverprofile'.format(subpackage)
|
||||||
|
|
||||||
coverprofiles.append(coverprofile)
|
coverprofiles.append(coverprofile)
|
||||||
|
|
||||||
_run('go test -v'.split() + [
|
_run('go test -v'.split() + [
|
||||||
'-coverprofile={}'.format(coverprofile),
|
'-coverprofile={}'.format(coverprofile),
|
||||||
'{}/{}'.format(PACKAGE_NAME, subpackage)
|
'{}/{}'.format(PACKAGE_NAME, subpackage)
|
||||||
])
|
])
|
||||||
|
|
||||||
combined = _combine_coverprofiles(coverprofiles)
|
combined = _combine_coverprofiles(coverprofiles)
|
||||||
_run('go tool cover -func={}'.format(combined.name).split())
|
_run('go tool cover -func={}'.format(combined.name).split())
|
||||||
combined.close()
|
combined.close()
|
||||||
|
else:
|
||||||
|
_run('go test -v ./...'.split())
|
||||||
|
|
||||||
_run(['gfmxr', '-c', str(_gfmxr_count()), '-s', 'README.md'])
|
_run(['gfmxr', '-c', str(_gfmxr_count()), '-s', 'README.md'])
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user