-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test trace
command: execute a trace against testnet
#61
Conversation
f836e2f
to
9584882
Compare
atomkraft/test/trace.py
Outdated
trace_test_stub = """ | ||
from modelator.pytest.decorators import itf | ||
|
||
pytest_plugins = "{0}" | ||
|
||
@itf("{1}", keypath="{2}") | ||
def test_trace(): | ||
print("Successfully executed trace {1}") | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 for this!
but best to make the variable name capitalize because it is a constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments 🙂
test_name = ( | ||
test_name.replace("/", "_") | ||
.replace(".", "_") | ||
.replace(":", "_") | ||
.replace("-", "_") | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're trying to convert test_name
to a valid snake case. You can use the case-converter
package here 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried it. snakecase
produces this
test_tracesexample0itfjson_2022_07_28t104954601.py
instead of this
test_traces_example0_itf_json_2022_07_28T10_49_54_601.py
The latter I believe is more readable; so let's leave it as is for now.
atomkraft/test/trace.py
Outdated
print(f"Writing {test_name} ...") | ||
test.write( | ||
trace_test_stub.format( | ||
str(reactor).replace("/", ".").replace(".py", ""), trace, keypath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use .removesuffix(".py")
instead of .replace(".py", "")
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Closes #27
This PR implements
atomkraft test trace
commandtrace
option is required now, until Store and retrieve the last model trace #55 is implementedtests
dirThis PR leaves for future work: