# Path: pyani/aniblastall.py
# class PyaniblastallException(PyaniException):
# def get_version(blast_exe: Path = pyani_config.BLASTALL_DEFAULT) -> str:


from pathlib import Path
from pyani import aniblastall
import unittest


# Test case 2: there is a file, but it is not executable
def test_get_version_not_executable(executable_not_executable):
    """Test behaviour when the file at the executable location is not executable."""
    test_file_2 = Path("/non/executable/blastall")
    assert (
        aniblastall.get_version(test_file_2)
        == f"blastall exists at {test_file_2} but not executable"
    )


# Test case 3: there is an executable file, but the version can't be retrieved
def test_get_version_no_version(executable_without_version):
    """Test behaviour when the version for the executable can not be retrieved."""
    test_file_3 = Path("/missing/version/blastall")
    assert (
        aniblastall.get_version(test_file_3)
        == f"blastall exists at {test_file_3} but could not retrieve version"
    )


# Test case 4: there is an executable file, but it will not run on the OS
def test_get_version_os_incompatible(executable_incompatible_with_os):
    """Test behaviour when the program can't run on the operating system.
    This will happen with newer versions of MacOS."""
    test_file_4 = Path("/os/incompatible/blastall")
    assert (
        aniblastall.get_version(test_file_4)
        == f"blastall exists at {test_file_4} but could not be executed"

# Path: pyani/aniblastall.py
# class PyaniblastallException(PyaniException):
# def get_version(blast_exe: Path = pyani_config.BLASTALL_DEFAULT) -> str:


# Path: tests/test_aniblastall.py
from pathlib import Path
from pyani import aniblastall
import unittest



# Test case 2: there is a file, but it is not executable
def test_get_version_not_executable(executable_not_executable):
    """Test behaviour when the file at the executable location is not executable."""
    test_file_2 = Path("/non/executable/blastall")
    assert (
        aniblastall.get_version(test_file_2)
        == f"blastall exists at {test_file_2} but not executable"
    )


# Test case 3: there is an executable file, but the version can't be retrieved
def test_get_version_no_version(executable_without_version):
    """Test behaviour when the version for the executable can not be retrieved."""
    test_file_3 = Path("/missing/version/blastall")
    assert (
        aniblastall.get_version(test_file_3)
        == f"blastall exists at {test_file_3} but could not retrieve version"
    )


# Test case 4: there is an executable file, but it will not run on the OS
def test_get_version_os_incompatible(executable_incompatible_with_os):
    """Test behaviour when the program can't run on the operating system.
    This will happen with newer versions of MacOS."""
    test_file_4 = Path("/os/incompatible/blastall")
    assert (
        aniblastall.get_version(test_file_4)
        == f"blastall exists at {test_file_4} but could not be executed"

    )