Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
mgiulini committed Dec 11, 2024
1 parent 43b0b4f commit 950df31
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_libio.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
"""Test libio."""
import tempfile
from pathlib import Path
import shutil

import pytest

from haddock.libs.libio import (
clean_suffix,
dot_suffix,
extract_files_flat,
file_exists,
folder_exists,
read_from_yaml,
Expand All @@ -15,6 +17,7 @@
)

from . import emptycfg, haddock3_yaml_cfg_examples
from . import golden_data


@pytest.mark.parametrize(
Expand Down Expand Up @@ -133,3 +136,15 @@ def test_folder_exists_wrong(i):
def test_folder_exists_wrong_othererror():
with pytest.raises(TypeError):
folder_exists("some_bad_path", exception=TypeError)


def test_extract_files_flat(monkeypatch):
"""Test extract_files_flat."""
with tempfile.TemporaryDirectory() as tempdir:
reference_archive = Path(golden_data, "ambig.tbl.tgz")
shutil.copy(reference_archive, tempdir)
monkeypatch.chdir(tempdir)
archive = Path(reference_archive.name)
# extract the archive
extract_files_flat(archive, ".")
assert Path("ambig_1.tbl").exists()

0 comments on commit 950df31

Please sign in to comment.