Skip to content

Commit

Permalink
[cdd/tests/test_compound/test_exmod.py] Revert test debug for those w…
Browse files Browse the repository at this point in the history
…hich are skipped on GitHub Actions ; [cdd/tests/test_shared/test_pkg_utils.py] Add test for `get_python_lib`
  • Loading branch information
SamuelMarks committed Mar 15, 2024
1 parent e5633f1 commit 17a6c55
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
7 changes: 6 additions & 1 deletion cdd/shared/pure_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from sys import stderr, version_info
from textwrap import fill as _fill
from textwrap import indent
from typing import Any, Callable, Dict, FrozenSet, Optional, Sized, Tuple, Union, cast
from typing import Any, Callable, Dict, Optional, Sized, Tuple, Union, cast

_python_major_minor: Tuple[int, int] = version_info[:2]
PY3_8: bool = _python_major_minor == (3, 8)
Expand All @@ -37,6 +37,11 @@

from typing_extensions import Literal, Protocol

if PY_GTE_3_9:
FrozenSet = frozenset
else:
from typing import FrozenSet

pp: Callable[[Any], None] = PrettyPrinter(indent=4, width=100, stream=stderr).pprint
tab: str = environ.get("DOCTRANS_TAB", " " * 4)
simple_types: Dict[Optional[str], Union[int, float, complex, str, bool, None]] = {
Expand Down
6 changes: 5 additions & 1 deletion cdd/sqlalchemy/utils/parse_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from ast import Assign, Call, ClassDef, Constant, Load, Module, Name
from itertools import chain, filterfalse
from operator import attrgetter
from typing import FrozenSet

import cdd.shared.ast_utils
import cdd.shared.source_transformer
from cdd.shared.pure_utils import (
PY_GTE_3_8,
PY_GTE_3_9,
append_to_dict,
indent_all_but_first,
rpartial,
Expand All @@ -23,6 +23,10 @@
else:
from ast import Str

if PY_GTE_3_9:
FrozenSet = frozenset
else:
from typing import FrozenSet

# SQLalchemy 1.14
# `from sqlalchemy import __all__; sorted(filter(lambda s: any(filter(str.isupper, s)), __all__))`
Expand Down
4 changes: 3 additions & 1 deletion cdd/tests/test_compound/test_exmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@

# IntOrTupleOfStr = TypeVar("IntOrTupleOfStr", Tuple[str], int)

github_actions_and_non_windows_and_gte_3_12: bool = False
github_actions_and_non_windows_and_gte_3_12: bool = (
"GITHUB_ACTIONS" in environ and platform != "win32" and PY_GTE_3_12
)
github_actions_err: str = "GitHub Actions fails this test (unable to replicate locally)"


Expand Down
7 changes: 6 additions & 1 deletion cdd/tests/test_shared/test_pkg_utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
""" Tests for pkg utils """

from site import getsitepackages
from unittest import TestCase

from cdd.shared.pkg_utils import relative_filename
from cdd.shared.pkg_utils import get_python_lib, relative_filename
from cdd.tests.utils_for_tests import unittest_main


Expand All @@ -14,5 +15,9 @@ def test_relative_filename(self) -> None:
expect: str = "gaffe"
self.assertEqual(relative_filename(expect), expect)

def test_get_python_lib(self) -> None:
"""Tests that `get_python_lib` works"""
self.assertEqual(getsitepackages()[0], get_python_lib())


unittest_main()

0 comments on commit 17a6c55

Please sign in to comment.