Skip to content

Commit 94a3ffa

Browse files
committed
[cdd/tests/test_compound/test_exmod.py] Revert test debug for those which are skipped on GitHub Actions ; [cdd/tests/test_shared/test_pkg_utils.py] Add test for get_python_lib
1 parent cd3a515 commit 94a3ffa

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

cdd/shared/pure_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from sys import stderr, version_info
2121
from textwrap import fill as _fill
2222
from textwrap import indent
23-
from typing import Any, Callable, Dict, FrozenSet, Optional, Sized, Tuple, Union, cast
23+
from typing import Any, Callable, Dict, Optional, Sized, Tuple, Union, cast
2424

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

3838
from typing_extensions import Literal, Protocol
3939

40+
if PY_GTE_3_9:
41+
FrozenSet = frozenset
42+
else:
43+
from typing import FrozenSet
44+
4045
pp: Callable[[Any], None] = PrettyPrinter(indent=4, width=100, stream=stderr).pprint
4146
tab: str = environ.get("DOCTRANS_TAB", " " * 4)
4247
simple_types: Dict[Optional[str], Union[int, float, complex, str, bool, None]] = {

cdd/sqlalchemy/utils/parse_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
from ast import Assign, Call, ClassDef, Constant, Load, Module, Name
77
from itertools import chain, filterfalse
88
from operator import attrgetter
9-
from typing import FrozenSet
109

1110
import cdd.shared.ast_utils
1211
import cdd.shared.source_transformer
1312
from cdd.shared.pure_utils import (
1413
PY_GTE_3_8,
14+
PY_GTE_3_9,
1515
append_to_dict,
1616
indent_all_but_first,
1717
rpartial,
@@ -23,6 +23,10 @@
2323
else:
2424
from ast import Str
2525

26+
if PY_GTE_3_9:
27+
FrozenSet = frozenset
28+
else:
29+
from typing import FrozenSet
2630

2731
# SQLalchemy 1.14
2832
# `from sqlalchemy import __all__; sorted(filter(lambda s: any(filter(str.isupper, s)), __all__))`

cdd/tests/test_compound/test_exmod.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939

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

42-
github_actions_and_non_windows_and_gte_3_12: bool = False
42+
github_actions_and_non_windows_and_gte_3_12: bool = (
43+
"GITHUB_ACTIONS" in environ and platform != "win32" and PY_GTE_3_12
44+
)
4345
github_actions_err: str = "GitHub Actions fails this test (unable to replicate locally)"
4446

4547

cdd/tests/test_shared/test_pkg_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
""" Tests for pkg utils """
22

3+
from site import getsitepackages
34
from unittest import TestCase
45

5-
from cdd.shared.pkg_utils import relative_filename
6+
from cdd.shared.pkg_utils import get_python_lib, relative_filename
67
from cdd.tests.utils_for_tests import unittest_main
78

89

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

18+
def test_get_python_lib(self) -> None:
19+
"""Tests that `get_python_lib` works"""
20+
self.assertEqual(getsitepackages()[0], get_python_lib())
21+
1722

1823
unittest_main()

0 commit comments

Comments
 (0)