Run migration tests via ./runtests
This commit is contained in:
parent
586b49ded8
commit
2cfb957033
11
.travis.yml
11
.travis.yml
@ -31,10 +31,6 @@ matrix:
|
||||
before_script:
|
||||
- go get github.com/urfave/gfmxr/...
|
||||
- $pip_install flake8
|
||||
- mkdir -p .extracted-examples
|
||||
- curl -sSL -o .extracted-examples/README.md
|
||||
'https://raw.githubusercontent.com/urfave/cli/v1/README.md'
|
||||
- pushd .extracted-examples && gfmxr extract -o . ; popd
|
||||
|
||||
script:
|
||||
- flake8 runtests cli-v1-to-v2
|
||||
@ -42,9 +38,4 @@ script:
|
||||
- ./runtests test
|
||||
- ./runtests gfmxr
|
||||
- ./cli-v1-to-v2 --selftest
|
||||
- for f in .extracted-examples/*.go ; do
|
||||
./cli-v1-to-v2 -w $f ;
|
||||
go build -o .extracted-examples/example $f ;
|
||||
./cli-v1-to-v2 -w $f ;
|
||||
go build -o .extracted-examples/example $f ;
|
||||
done
|
||||
- ./runtests migrations
|
||||
|
@ -24,3 +24,4 @@ build_script:
|
||||
- python runtests test
|
||||
- python runtests gfmxr
|
||||
- python cli-v1-to-v2 --selftest
|
||||
- python runtests migrations
|
||||
|
26
runtests
26
runtests
@ -2,7 +2,9 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
@ -65,6 +67,30 @@ def _vet():
|
||||
_run('go vet ./...'.split())
|
||||
|
||||
|
||||
@_target
|
||||
def _migrations():
|
||||
migration_script = os.path.abspath(
|
||||
os.environ.get('V1TOV2', './cli-v1-to-v2')
|
||||
)
|
||||
v1_readme_url = os.environ.get(
|
||||
'V1README',
|
||||
'https://raw.githubusercontent.com/urfave/cli/v1/README.md'
|
||||
)
|
||||
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
try:
|
||||
os.chdir(tmpdir)
|
||||
_run('curl -sSL -o README.md {}'.format(v1_readme_url).split())
|
||||
_run('gfmxr extract -o .'.split())
|
||||
|
||||
for gofile in glob.glob('*.go'):
|
||||
for i in (0, 1):
|
||||
_run(['python', migration_script, '-w', gofile])
|
||||
_run('go build -o tmp.out {}'.format(gofile).split())
|
||||
finally:
|
||||
shutil.rmtree(tmpdir, ignore_errors=True)
|
||||
|
||||
|
||||
def _run(command):
|
||||
print('runtests: {}'.format(' '.join(command)), file=sys.stderr)
|
||||
check_call(command)
|
||||
|
Loading…
Reference in New Issue
Block a user