Skip to content

Commit

Permalink
export logger (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gryfenfer97 authored Sep 6, 2023
1 parent 83a02b6 commit 83e07b8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/ansys/tools/path/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


from ansys.tools.path.path import (
LOG,
SETTINGS_DIR,
SUPPORTED_ANSYS_VERSIONS,
change_default_mapdl_path,
Expand All @@ -30,6 +31,7 @@
from ansys.tools.path.path import save_ansys_path # deprecated

__all__ = [
"LOG",
"SETTINGS_DIR",
"SUPPORTED_ANSYS_VERSIONS",
"change_default_mapdl_path",
Expand Down
7 changes: 6 additions & 1 deletion src/ansys/tools/path/path.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass
from glob import glob
import json
import logging as LOG # Temporal hack
import logging
import os
import re
from typing import Callable, Dict, Literal, Optional, Tuple, Union
Expand All @@ -11,6 +11,8 @@

from ansys.tools.path.misc import is_float, is_linux, is_windows

LOG = logging.getLogger(__name__)

PRODUCT_TYPE = Literal["mapdl", "mechanical"]
SUPPORTED_VERSIONS_TYPE = Dict[int, str]

Expand Down Expand Up @@ -107,6 +109,7 @@ def _get_default_linux_base_path() -> Optional[str]:
"""Get the default base path of the Ansys unified install on linux."""

for path in LINUX_DEFAULT_DIRS:
LOG.debug(f"Checking {path} as a potential ansys directory")
if os.path.isdir(path):
return path
return None
Expand Down Expand Up @@ -779,6 +782,8 @@ def _get_application_path(
if exe_loc is not None:
return exe_loc

LOG.debug(f"{product} path not found in config file")

try:
exe_loc, exe_version = _find_installation(product, version)
if (exe_loc, exe_version) != ("", ""): # executable not found
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_path.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import logging
import os
import sys
from unittest.mock import patch
Expand All @@ -8,6 +9,7 @@
import pytest

from ansys.tools.path import (
LOG,
SETTINGS_DIR,
change_default_ansys_path,
change_default_mapdl_path,
Expand All @@ -25,6 +27,8 @@
version_from_path,
)

LOG.setLevel(logging.DEBUG)

VERSIONS = [202, 211, 231]
STUDENT_VERSIONS = [201, 211]

Expand Down

0 comments on commit 83e07b8

Please sign in to comment.