From 89964e635d8edff5bf0a60350d9bd839d3a2e8ca Mon Sep 17 00:00:00 2001 From: pawanjay176 Date: Tue, 18 Jul 2017 23:13:25 +0530 Subject: [PATCH] added commandline option to print vm trace --- ethereum/tests/conftest.py | 10 ++++++++++ ethereum/tests/test_state.py | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ethereum/tests/conftest.py b/ethereum/tests/conftest.py index ca6209271..eea891c47 100644 --- a/ethereum/tests/conftest.py +++ b/ethereum/tests/conftest.py @@ -17,3 +17,13 @@ def pytest_runtest_call(item): if catchlog_handler and catchlog_handler in slogging.rootLogger.handlers: slogging.rootLogger.removeHandler(catchlog_handler) + + +# Configuration file for adding commandline arguements in pytest +def pytest_addoption(parser): + parser.addoption("--tracevm", action="store_true", + help="print vm trace") + +@pytest.fixture +def tracevm(request): + return request.config.getoption("--tracevm") \ No newline at end of file diff --git a/ethereum/tests/test_state.py b/ethereum/tests/test_state.py index d1005ffbc..7f1bf5495 100644 --- a/ethereum/tests/test_state.py +++ b/ethereum/tests/test_state.py @@ -6,9 +6,9 @@ logger = get_logger() # customize VM log output to your needs # hint: use 'py.test' with the '-s' option to dump logs to the console -if '--trace' in sys.argv: # not default +if '--tracevm' in sys.argv: # not default configure_logging(':trace') - sys.argv.remove('--trace') + sys.argv.remove('--tracevm') def test_state(filename, testname, testdata):