"""Test the locan package.This module includes a minimal set of unit tests for the locan package.An extended set of tests is available in the upstream tests directory andorganized following the subpackage structure of locan."""from__future__importannotationsfromtypingimportTYPE_CHECKINGfromlocanimportROOT_DIRifTYPE_CHECKING:frompytestimportExitCode__all__:list[str]=["test"]
[docs]deftest(args:str|list[str]|None=None)->int|ExitCode:""" Running tests with pytest. Parameters ---------- args Parameters passed to :func:`pytest.main` """try:importpytestexceptImportErrorasexc:raiseImportError("Need pytest to run tests.")fromexcextra_args=["-m not gui and not visual"]ifargsisNone:pass# extra_args = []elifisinstance(args,list):extra_args.extend(args)# extra_args = argselse:extra_args.append(args)# extra_args = [args]test_directory=ROOT_DIR.joinpath("tests").as_posix()extra_args.append(test_directory)print(f'running: pytest {" ".join(extra_args)}')returnpytest.main(extra_args)