diff --git a/pdm.lock b/pdm.lock index 3e6d6d8..fd57fed 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "test", "dev"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.1" -content_hash = "sha256:675d0087ff46f3bfd5b3e026e1cbb3aa6840cff9ac0dcedbb9710d5cfbce38ac" +content_hash = "sha256:253ddec953150d944f40ed508f2472dad64d4691281c7a8741683c5fd8c5ccba" [[package]] name = "argparse" @@ -33,7 +33,7 @@ name = "colorama" version = "0.4.6" requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" summary = "Cross-platform colored terminal text." -groups = ["dev", "test"] +groups = ["default", "dev", "test"] marker = "sys_platform == \"win32\"" files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, @@ -57,7 +57,7 @@ name = "iniconfig" version = "2.0.0" requires_python = ">=3.7" summary = "brain-dead simple config-ini parsing" -groups = ["test"] +groups = ["default", "dev", "test"] files = [ {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, @@ -90,7 +90,7 @@ name = "packaging" version = "24.0" requires_python = ">=3.7" summary = "Core utilities for Python packages" -groups = ["test"] +groups = ["default", "dev", "test"] files = [ {file = "packaging-24.0-py3-none-any.whl", hash = "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5"}, {file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"}, @@ -122,7 +122,7 @@ name = "pluggy" version = "1.5.0" requires_python = ">=3.8" summary = "plugin and hook calling mechanisms for python" -groups = ["test"] +groups = ["default", "dev", "test"] files = [ {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, @@ -154,7 +154,7 @@ name = "pytest" version = "8.1.1" requires_python = ">=3.8" summary = "pytest: simple powerful testing with Python" -groups = ["test"] +groups = ["default", "dev", "test"] dependencies = [ "colorama; sys_platform == \"win32\"", "iniconfig", diff --git a/pyproject.toml b/pyproject.toml index 33bd623..57aa980 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,11 +25,15 @@ classifiers = [ dependencies = [ "argparse", "pathlib", + "pytest>=8.1.1", ] license = {text = "GPL"} [project.optional-dependencies] -dev = ["pylint"] +dev = [ + "pylint", + "pytest>=8.1.1", +] test = ["pytest"] [project.urls] diff --git a/tests/integration/test_converter.py b/tests/integration/test_converter.py index b6736a3..dc124e4 100644 --- a/tests/integration/test_converter.py +++ b/tests/integration/test_converter.py @@ -1,19 +1,34 @@ +from pytest import fixture import ergogen_footprint_converter.main as main -def test_simple(tmp_path): + +@fixture +def out_dir (tmp_path): out_dir = tmp_path / "out" out_dir.mkdir() + return out_dir +@fixture +def call_main (in_name, out_dir): args = { - "in": "./data/simple/promicro.kicad_mod", + "in": "tests/integration/data/simple/" + in_name, "out": out_dir } main.main(args) - expected = open("tests/integration/data/simple/promicro.js").readlines() + return out_dir / (in_name.split('.')[0] + ".js") + +def test_exists(call_main): + out = call_main("promicro.kicad_mod") + + assert out.exists() + +def test_simple(call_main): + out = call_main("promicro.kicad_mod") + + expected = open("tests/integration/data/simple/promicro.js").readlines() - out = out_dir / "promicro.js" assert out.read_text() == expected