Skip to content

Commit

Permalink
Added tests for create_gridwrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
blumenstiel committed Oct 23, 2023
1 parent cb5a74a commit 2e1a42d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/example_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ def main(*args):

print(args)


def process(batch, *args):
# process function for grid wrapper
print('Execute batch:', batch)
main(batch, *args, input_path, batch_size, debug, output_path)


if __name__ == '__main__':
main(input_path, batch_size, debug, output_path)
37 changes: 37 additions & 0 deletions tests/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,40 @@ def test_create_operator(
file = Path(file_path)
file.with_suffix('.yaml').unlink()
file.with_suffix('.job.yaml').unlink()
# TODO: Add tests for the created container image


test_create_gridwrapper_input = [
(
TEST_NOTEBOOK_PATH,
DUMMY_REPO,
'your_function',
[],
),
(
TEST_SCRIPT_PATH,
DUMMY_REPO,
'process',
[TEST_NOTEBOOK_PATH],
)
]
@pytest.mark.parametrize(
"file_path, repository, process, args",
test_create_gridwrapper_input,
)
def test_create_gridwrapper(
file_path: str,
repository: str,
process: str,
args: List,
):
subprocess.run(['python', '../src/c3/create_gridwrapper.py', file_path, *args,
'-r', repository, '-p', process], check=True)

file = Path(file_path)
gw_file = file.parent / f'gw_{file.stem}.py'

gw_file.with_suffix('.yaml').unlink()
gw_file.with_suffix('.job.yaml').unlink()
gw_file.unlink()
# TODO: Add tests for the created container image

0 comments on commit 2e1a42d

Please sign in to comment.