diff --git a/atomkraft/test/__init__.py b/atomkraft/test/__init__.py index a3dce77..3a46ee2 100644 --- a/atomkraft/test/__init__.py +++ b/atomkraft/test/__init__.py @@ -37,7 +37,7 @@ def trace( Test blockchain by running one trace """ - test_trace(trace.name, reactor.name, keypath) + test_trace(trace.name, reactor if reactor is None else reactor.name, keypath) @app.command() diff --git a/atomkraft/test/trace.py b/atomkraft/test/trace.py index b52fae8..fd0e68a 100644 --- a/atomkraft/test/trace.py +++ b/atomkraft/test/trace.py @@ -2,6 +2,8 @@ from atomkraft.utils.project import project_root import os.path from datetime import datetime +import pytest +from ..reactor.reactor import get_reactor trace_test_stub = """ @@ -20,6 +22,9 @@ def test_trace(trace: PathLike, reactor: PathLike, keypath: str): Test blockchain by running one trace """ + if reactor is None: + reactor = get_reactor() + root = project_root() if not root: raise RuntimeError( @@ -40,10 +45,13 @@ def test_trace(trace: PathLike, reactor: PathLike, keypath: str): .replace(":", "_") .replace("-", "_") ) - test = os.path.join(tests, f"{test_name}.py") - with open(test, "w") as test: + test_path = os.path.join(tests, f"{test_name}.py") + with open(test_path, "w") as test: + print(f"Writing {test_name} ...") test.write( trace_test_stub.format( str(reactor).replace("/", ".").replace(".py", ""), trace, keypath ) ) + print(f"Executing {test_name} ...") + pytest.main(["-s", test_path])