Skip to content

Commit

Permalink
Give exec with its own dict for globals and locals
Browse files Browse the repository at this point in the history
  • Loading branch information
Zehvogel committed Aug 29, 2023
1 parent 948460e commit ac4d8e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion k4FWCore/scripts/k4run
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ seen_files = set()
option_db = {}

def load_file(file):
exec(file.read())
exec(file.read(), {})


def add_arguments(parser, app_mgr):
Expand Down
5 changes: 5 additions & 0 deletions test/k4FWCoreTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,8 @@ add_test(NAME Testk4runHelpOnly
set_test_env(Testk4runHelpOnly)
set_tests_properties(Testk4runHelpOnly
PROPERTIES PASS_REGULAR_EXPRESSION "show this help message and exit")

add_test(NAME TestExec
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMAND ${K4RUN} --dry-run options/TestExec.py)
set_test_env(TestExec)
2 changes: 2 additions & 0 deletions test/k4FWCoreTest/options/TestExec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a = 5
comp = [a for i in range(3)]

0 comments on commit ac4d8e3

Please sign in to comment.