aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/test_framework.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-03-22 10:26:02 -0400
committerJohn Newbery <john@johnnewbery.com>2017-03-22 10:26:02 -0400
commit232b6665bc3e5b134821dc7584968fb439fd5f44 (patch)
treefce7c7a20289da596cac34147e20f5cd7303b5ec /test/functional/test_framework/test_framework.py
parent02d64bd929c9663ba38e96721c6dbd89972d043d (diff)
downloadbitcoin-232b6665bc3e5b134821dc7584968fb439fd5f44.tar.xz
Allow test cases to be skipped
Currently, functional test cases can either pass or fail. There are occasions when it is helpful to skip tests, for example if the system they are running on does not meet the requirements for the test. The rest of the test suite can run without being marked as a failure. This commit adds framework for tests to skip if their requirements aren't met.
Diffstat (limited to 'test/functional/test_framework/test_framework.py')
-rwxr-xr-xtest/functional/test_framework/test_framework.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index fd2e803541..198c0cb5af 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -28,9 +28,12 @@ from .util import (
)
from .authproxy import JSONRPCException
-
class BitcoinTestFramework(object):
+ TEST_EXIT_PASSED = 0
+ TEST_EXIT_FAILED = 1
+ TEST_EXIT_SKIPPED = 77
+
def __init__(self):
self.num_nodes = 4
self.setup_clean_chain = False
@@ -183,11 +186,11 @@ class BitcoinTestFramework(object):
print("".join(deque(open(f), MAX_LINES_TO_PRINT)))
if success:
self.log.info("Tests successful")
- sys.exit(0)
+ sys.exit(self.TEST_EXIT_PASSED)
else:
self.log.error("Test failed. Test logging available at %s/test_framework.log", self.options.tmpdir)
logging.shutdown()
- sys.exit(1)
+ sys.exit(self.TEST_EXIT_FAILED)
def _start_logging(self):
# Add logger and logging handlers