Skip to content

Commit

Permalink
Add prepend_text and append_text to aiida_local_code_factory py…
Browse files Browse the repository at this point in the history
…test fixture (#3831)
  • Loading branch information
sphuber authored Mar 4, 2020
1 parent ba83912 commit ed7a0b6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion aiida/manage/tests/pytest_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,17 @@ def test_1(aiida_local_code_factory):
:rtype: object
"""

def get_code(entry_point, executable, computer=aiida_localhost):
def get_code(entry_point, executable, computer=aiida_localhost, prepend_text=None, append_text=None):
"""Get local code.
Sets up code for given entry point on given computer.
:param entry_point: Entry point of calculation plugin
:param executable: name of executable; will be searched for in local system PATH.
:param computer: (local) AiiDA computer
:param prepend_text: a string of code that will be put in the scheduler script before the
execution of the code.
:param append_text: a string of code that will be put in the scheduler script after the
execution of the code.
:return: The code node
:rtype: :py:class:`aiida.orm.Code`
"""
Expand All @@ -158,6 +162,10 @@ def get_code(entry_point, executable, computer=aiida_localhost):
input_plugin_name=entry_point,
remote_computer_exec=[computer, executable_path],
)
if prepend_text is not None:
code.set_prepend_text(prepend_text)
if append_text is not None:
code.set_append_text(append_text)
code.label = executable
return code.store()

Expand Down

0 comments on commit ed7a0b6

Please sign in to comment.