Skip to content

Commit

Permalink
Inline creation of temporary molfile
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCBrammer committed Oct 16, 2024
1 parent 236a36e commit 478aa8d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 25 deletions.
7 changes: 5 additions & 2 deletions INCHI-1-TEST/tests/test_executable/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,18 @@ def parse_aux_info_from_executable_output(output: str) -> str:

@pytest.fixture
def run_inchi_exe(request, tmp_path: Path) -> Callable:
def _run_inchi_exe(molfile_path: str, args: str = "") -> InchiResult:
def _run_inchi_exe(molfile: str, args: str = "") -> InchiResult:

exe_path: str = request.config.getoption("--exe-path")
if not Path(exe_path).exists():
raise FileNotFoundError(f"InChI executable not found at {exe_path}.")

output_path = tmp_path.joinpath("output.txt")
molfile_path = tmp_path.joinpath("tmp.mol")
molfile_path.write_text(molfile)

result = subprocess.run(
[exe_path, molfile_path, str(output_path)] + args.split(),
[exe_path, str(molfile_path), str(output_path)] + args.split(),
capture_output=True,
text=True,
)
Expand Down
18 changes: 0 additions & 18 deletions INCHI-1-TEST/tests/test_executable/helpers.py

This file was deleted.

2 changes: 0 additions & 2 deletions INCHI-1-TEST/tests/test_executable/test_github_40.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import pytest
from helpers import tmp_molfile


@pytest.fixture
@tmp_molfile
def molfile():
return """(R)-SDP
ChemDraw08122419562D
Expand Down
3 changes: 0 additions & 3 deletions INCHI-1-TEST/tests/test_executable/test_github_52.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import pytest
from helpers import tmp_molfile


@pytest.fixture
@tmp_molfile
def molfile_empty_bondblock():
return """
-INDIGO-08292417452D
Expand All @@ -22,7 +20,6 @@ def molfile_empty_bondblock():


@pytest.fixture
@tmp_molfile
def molfile_no_bondblock():
return """
-INDIGO-08292417452D
Expand Down

0 comments on commit 478aa8d

Please sign in to comment.