How to use the anypytools.tools.get_anybodycon_path function in anypytools

To help you get started, we’ve selected a few anypytools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AnyBody-Research-Group / AnyPyTools / anypytools / pytest_plugin.py View on Github external
def configure(self, config):
        """Configure the AnyTestSession object.

        This can't be in __init__()
        since it is instantiated and added to the pytest namespace very
        early in the pytest startup.
        """

        ammr_path = find_ammr_path(config.getoption("--ammr") or config.rootdir.strpath)
        self.ammr_version = get_ammr_version(ammr_path)
        self.ams_path = config.getoption("--anybodycon") or get_anybodycon_path()
        self.ams_path = os.path.abspath(self.ams_path) if self.ams_path else ""
        self.ams_version = anybodycon_version(self.ams_path)
        major_ammr_ver = 1 if self.ammr_version.startswith("1") else 2
        self.bm_constants_map = get_bm_constants(
            ammr_path=ammr_path, ammr_version=major_ammr_ver
        )
github AnyBody-Research-Group / AnyPyTools / anypytools / pytest_plugin.py View on Github external
def pytest_xdist_setupnodes(self, config, specs):
        """ called before any remote node is set up. """
        print(
            "\n\nUsing AnyBodyCon: ",
            config.getoption("--anybodycon") or get_anybodycon_path(),
            "\n",
        )
github AnyBody-Research-Group / AnyPyTools / tests / test_tools.py View on Github external
def test_get_anybodycon_path():
    abc = get_anybodycon_path()

    assert os.path.exists(abc)
github AnyBody-Research-Group / AnyPyTools / anypytools / abcutils.py View on Github external
-------
    int
        The return code from the AnyBody Console application.

    """

    try:
        macro_filename = os.path.splitext(logfile.name)[0] + ".anymcr"
    except AttributeError:
        macro_filename = "macrofile.anymcr"

    if logfile is None:
        logfile = sys.stdout

    if anybodycon_path is None:
        anybodycon_path = Path(get_anybodycon_path())

    if macro and macro[-1] != "exit":
        macro.append("exit")

    if not os.path.isfile(anybodycon_path):
        raise IOError(f"Can not find anybodycon.exe: {anybodycon_path}")

    with open(macro_filename, "w+b") as macro_file:
        macro_file.write("\n".join(macro).encode("UTF-8"))
        macro_file.flush()
    anybodycmd = [
        str(anybodycon_path.resolve()),
        "--macro=",
        macro_file.name,
        "/deb",
        str(debug_mode),
github AnyBody-Research-Group / AnyPyTools / anypytools / abcutils.py View on Github external
DeprecationWarning,
                stacklevel=2,
            )
        if len(kwargs):
            warnings.warn(
                "The following input arguments are not supported/understood:\n"
                + str(list(kwargs.keys()))
            )
        if not isinstance(ignore_errors, (list, type(None))):
            raise ValueError("ignore_errors must be a list of strings")

        if not isinstance(warnings_to_include, (list, type(None))):
            raise ValueError("warnings_to_include must be a list of strings")

        if anybodycon_path is None:
            anybodycon_path = get_anybodycon_path()
        anybodycon_path = Path(anybodycon_path)
        if use_gui:
            anybodycon_path = anybodycon_path.with_name(
                case_preserving_replace(anybodycon_path.name, "anybodycon", "anybody")
            )

        if anybodycon_path.exists():
            self.anybodycon_path = anybodycon_path
        else:
            raise IOError(f"Can't find  {anybodycon_path}")
        self.num_processes = num_processes
        self.priority = priority
        self.silent = silent
        self.timeout = timeout
        self.counter = 0
        self.debug_mode = debug_mode