fix api_tests to work without existence of test_support

This commit is contained in:
Aaron Blankstein
2018-04-20 15:47:14 -04:00
parent ee75de975f
commit 614547cecd
2 changed files with 15 additions and 30 deletions

View File

@@ -8,18 +8,18 @@ jobs:
PIPENV_VENV_IN_PROJECT: true
steps:
- checkout
## - restore_cache:
## key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- restore_cache:
key: deps9-{{ .Branch }}-{{ checksum "setup.py" }}-{{ checksum "integration_tests/setup.py" }}
- run:
command: |
python -m virtualenv venv
source venv/bin/activate
pip install ./integration_tests
pip install . --upgrade
## - save_cache:
## key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
## paths:
## - "venv"
pip install ./integration_tests --upgrade --upgrade-strategy only-if-needed
pip install . --upgrade --upgrade-strategy only-if-needed
- save_cache:
key: deps9-{{ .Branch }}-{{ checksum "setup.py" }}-{{ checksum "integration_tests/setup.py" }}
paths:
- "venv"
- run:
command: |
source venv/bin/activate

View File

@@ -28,7 +28,6 @@ import binascii
import traceback
import jsontokens
from test import test_support
from binascii import hexlify
from blockstack_client import schemas
@@ -447,27 +446,7 @@ def test_main(args = []):
for t in test_classes:
test_map[t.__name__] = t
with test_support.captured_stdout() as out:
try:
test_support.run_unittest(PingTest)
except Exception as e:
traceback.print_exc(file=sys.stdout)
out = out.getvalue()
if out[-3:-1] != "OK":
print(out)
print("Failure of the ping test means the rest of the unit tests will " +
"fail. Is the blockstack api daemon running? (did you run " +
"`blockstack api start`)")
sys.exit(1)
if len(args) == 1 and args[0] == "--list":
print("Tests supported: ")
for testname in test_map.keys():
print(testname)
return
test_runner = test_support.run_unittest
test_runner = unittest.TextTestRunner(verbosity=2).run
if "--xunit-path" in args:
ainx = args.index("--xunit-path")
@@ -476,6 +455,12 @@ def test_main(args = []):
test_runner = XMLTestRunner(output=args[ainx]).run
del args[ainx]
if len(args) == 1 and args[0] == "--list":
print("Tests supported: ")
for testname in test_map.keys():
print(testname)
return
if "--api_password" in args:
ainx = args.index("--api_password")
del args[ainx]