# Path: pyani/pyani_orm.py
# class PyaniORMException(PyaniException):
# class LabelTuple(NamedTuple):
# class Label(Base):
# class BlastDB(Base):
# class Genome(Base):
# class Run(Base):
# class Comparison(Base):
#     def __str__(self) -> str:
#     def __repr__(self) -> str:
#     def __str__(self) -> str:
#     def __repr__(self) -> str:
#     def __str__(self) -> str:
#     def __repr__(self) -> str:
#     def __str__(self) -> str:
#     def __repr__(self) -> str:
#     def __str__(self) -> str:
#     def __repr__(self) -> str:
# def create_db(dbpath: Path) -> None:
# def get_session(dbpath: Path) -> Any:
# def get_comparison_dict(session: Any) -> Dict[Tuple, Any]:
# def get_matrix_labels_for_run(session: Any, run_id: int) -> Dict:
# def get_matrix_classes_for_run(session: Any, run_id: int) -> Dict[str, List]:
# def filter_existing_comparisons(
#     session,
#     run,
#     comparisons,
#     program,
#     version,
#     fragsize: Optional[int] = None,
#     maxmatch: Optional[bool] = False,
#     kmersize: Optional[int] = None,
#     minmatch: Optional[float] = None,
# ) -> List:
# def add_run(session, method, cmdline, date, status, name):
# def add_run_genomes(
#     session, run, indir: Path, classpath: Path, labelpath: Path, **kwargs
# ) -> List:
# def update_comparison_matrices(session, run) -> None:
# 
# Path: pyani/scripts/pyani_script.py
# VERSION_INFO = f"pyani version: {__version__}"
# CITATION_INFO = [
#     termcolor(
#         "If you use pyani in your work, please cite the following publication:", "green"
#     ),
#     termcolor(
#         "\tPritchard, L., Glover, R. H., Humphris, S., Elphinstone, J. G.,", "yellow"
#     ),
#     termcolor(
#         "\t& Toth, I.K. (2016) 'Genomics and taxonomy in diagnostics for", "yellow"
#     ),
#     termcolor(
#         "\tfood security: soft-rotting enterobacterial plant pathogens.'", "yellow"
#     ),
#     termcolor(
#         "\tAnalytical Methods, 8(1), 12–24. http://doi.org/10.1039/C5AY02550H", "yellow"
#     ),
# ]
# def run_main(argv: Optional[List[str]] = None) -> int:
# def add_log_headers():


import logging
import pytest
from pathlib import Path
from pyani import pyani_orm
from pyani.scripts import pyani_script
@pytest.fixture
def args_single_genome_download(email_address, tmp_path):
    """Command-line arguments for single genome download."""
    return [
        "download",
        "-t",
        "218491",
        "--email",
        email_address,
        "-o",
        tmp_path,
        "--force",
    ]


def test_createdb(args_createdb, monkeypatch):
    """Create empty test database."""

    def mock_return_none(*args, **kwargs):
        return None

    monkeypatch.setattr(pyani_orm, "create_db", mock_return_none)
    pyani_script.run_main(args_createdb)


def test_download_single_genome(args_single_genome_download, mock_single_genome_dl):
    """Download a single genome.

    We mock the remote database access
    """

# Path: pyani/pyani_orm.py
# class PyaniORMException(PyaniException):
# class LabelTuple(NamedTuple):
# class Label(Base):
# class BlastDB(Base):
# class Genome(Base):
# class Run(Base):
# class Comparison(Base):
#     def __str__(self) -> str:
#     def __repr__(self) -> str:
#     def __str__(self) -> str:
#     def __repr__(self) -> str:
#     def __str__(self) -> str:
#     def __repr__(self) -> str:
#     def __str__(self) -> str:
#     def __repr__(self) -> str:
#     def __str__(self) -> str:
#     def __repr__(self) -> str:
# def create_db(dbpath: Path) -> None:
# def get_session(dbpath: Path) -> Any:
# def get_comparison_dict(session: Any) -> Dict[Tuple, Any]:
# def get_matrix_labels_for_run(session: Any, run_id: int) -> Dict:
# def get_matrix_classes_for_run(session: Any, run_id: int) -> Dict[str, List]:
# def filter_existing_comparisons(
#     session,
#     run,
#     comparisons,
#     program,
#     version,
#     fragsize: Optional[int] = None,
#     maxmatch: Optional[bool] = False,
#     kmersize: Optional[int] = None,
#     minmatch: Optional[float] = None,
# ) -> List:
# def add_run(session, method, cmdline, date, status, name):
# def add_run_genomes(
#     session, run, indir: Path, classpath: Path, labelpath: Path, **kwargs
# ) -> List:
# def update_comparison_matrices(session, run) -> None:
# 
# Path: pyani/scripts/pyani_script.py
# VERSION_INFO = f"pyani version: {__version__}"
# CITATION_INFO = [
#     termcolor(
#         "If you use pyani in your work, please cite the following publication:", "green"
#     ),
#     termcolor(
#         "\tPritchard, L., Glover, R. H., Humphris, S., Elphinstone, J. G.,", "yellow"
#     ),
#     termcolor(
#         "\t& Toth, I.K. (2016) 'Genomics and taxonomy in diagnostics for", "yellow"
#     ),
#     termcolor(
#         "\tfood security: soft-rotting enterobacterial plant pathogens.'", "yellow"
#     ),
#     termcolor(
#         "\tAnalytical Methods, 8(1), 12–24. http://doi.org/10.1039/C5AY02550H", "yellow"
#     ),
# ]
# def run_main(argv: Optional[List[str]] = None) -> int:
# def add_log_headers():


# Path: tests/test_cli_parsing.py
import logging
import pytest
from pathlib import Path
from pyani import pyani_orm
from pyani.scripts import pyani_script

@pytest.fixture
def args_single_genome_download(email_address, tmp_path):
    """Command-line arguments for single genome download."""
    return [
        "download",
        "-t",
        "218491",
        "--email",
        email_address,
        "-o",
        tmp_path,
        "--force",
    ]


def test_createdb(args_createdb, monkeypatch):
    """Create empty test database."""

    def mock_return_none(*args, **kwargs):
        return None

    monkeypatch.setattr(pyani_orm, "create_db", mock_return_none)
    pyani_script.run_main(args_createdb)


def test_download_single_genome(args_single_genome_download, mock_single_genome_dl):
    """Download a single genome.

    We mock the remote database access
    """

    pyani_script.run_main(args_single_genome_download)