Rewrite tests
This commit is contained in:
@@ -5,11 +5,19 @@ from pathlib import Path
|
|||||||
|
|
||||||
|
|
||||||
def main (args):
|
def main (args):
|
||||||
|
print(args)
|
||||||
|
in_file: Path = args["in_file"]
|
||||||
|
out_dir: Path = args["out"]
|
||||||
|
if not in_file.exists():
|
||||||
|
raise FileNotFoundError("Input file not found!")
|
||||||
|
|
||||||
|
out_dir.mkdir(exist_ok=True)
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
parser.add_argument("in", type=Path)
|
parser.add_argument("in_file", type=Path)
|
||||||
parser.add_argument("--out", type=Path, required=False, default=Path('.'))
|
parser.add_argument("--out", type=Path, required=False, default=Path('.'))
|
||||||
|
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
from pytest import fixture
|
from pytest import fixture
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import ergogen_footprint_converter.main as main
|
import ergogen_footprint_converter.main as main
|
||||||
|
|
||||||
res_path = "tests/integration/data/simple/"
|
res_path = "tests/integration/data/simple/"
|
||||||
@@ -14,8 +17,8 @@ def out_dir (tmp_path):
|
|||||||
|
|
||||||
def call_main (in_file, out_dir):
|
def call_main (in_file, out_dir):
|
||||||
args = {
|
args = {
|
||||||
"in": res_path + in_file,
|
"in_file": Path(res_path + in_file),
|
||||||
"out": out_dir
|
"out": Path(out_dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
main.main(args)
|
main.main(args)
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
from ergogen_footprint_converter.parser import Parser
|
from ergogen_footprint_converter.parser import Parser
|
||||||
|
import pytest
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
def test_parser_filenotexists():
|
||||||
|
with pytest.raises(Exception, match=r".*Given path is not a file.*"):
|
||||||
|
Parser(Path("nop"))
|
||||||
|
|
||||||
def test_parser():
|
def test_parser():
|
||||||
None
|
None
|
||||||
|
|||||||
Reference in New Issue
Block a user