Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterKraus committed Sep 11, 2024
1 parent 4c39c18 commit 553382d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
13 changes: 10 additions & 3 deletions beam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
.. _yardsite: https://yard.datatractor.org/
"""

import argparse
import json
import multiprocessing.managers
import multiprocessing.shared_memory
Expand All @@ -24,12 +24,11 @@
import urllib.error
import urllib.request
import venv
import argparse
from enum import Enum
from importlib import metadata
from pathlib import Path
from types import ModuleType
from typing import Any, Callable, Optional
from importlib import metadata

__all__ = ("extract", "Extractor")

Expand Down Expand Up @@ -68,11 +67,19 @@ def run_beam():
default=None,
)

argparser.add_argument(
"--outfile",
"-o",
help="Optional path of the output file",
default=None,
)

args = argparser.parse_args()

extract(
input_path=args.infile,
input_type=args.filetype,
output_path=args.outfile,
preferred_mode=SupportedExecutionMethod.CLI,
)

Expand Down
11 changes: 11 additions & 0 deletions tests/test_mpr.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import subprocess
import urllib.request
from pathlib import Path

Expand Down Expand Up @@ -146,3 +147,13 @@ def test_extractorplan_python_method():
function, args, kwargs = ExtractorPlan._prepare_python(
'extract(filename="example.txt", type={"test": "example", "dictionary": "example"})'
)


def test_biologic_beam(tmp_path, test_mprs):
for ind, test_mpr in enumerate(test_mprs):
input_path = tmp_path / test_mpr
output_path = tmp_path / test_mpr.name.replace(".mpr", ".nc")
task = ["beam", "biologic-mpr", str(input_path), "--outfile", str(output_path)]
subprocess.run(task)
assert output_path.exists()
break

0 comments on commit 553382d

Please sign in to comment.