Skip to content

Commit

Permalink
Execute python script runs at module level (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
boffman committed Mar 19, 2024
1 parent a22acea commit 3e067eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion grizzly/steps/scenario/setup.py
Expand Up @@ -264,7 +264,7 @@ def _execute_python_script(context: Context, source: str) -> None:
if on_worker(context):
return

exec(source) # noqa: S102
exec(source, globals(), globals()) # noqa: S102

@then('execute python script "{script_path}"')
def step_setup_execute_python_script(context: Context, script_path: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_grizzly/steps/test_setup.py
Expand Up @@ -278,5 +278,5 @@ def test__execute_python_script(behave_fixture: BehaveFixture, mocker: MockerFix
_execute_python_script(context, "print('foobar')")

on_worker_mock.assert_called_once_with(context)
exec_mock.assert_called_once_with("print('foobar')")
exec_mock.assert_called_once_with("print('foobar')", ANY(dict), ANY(dict))

0 comments on commit 3e067eb

Please sign in to comment.