Skip to content

Commit 0e2a512

Browse files
committed
fixed test that is failing only in GH actions
1 parent 81c94b0 commit 0e2a512

File tree

5 files changed

+26
-24
lines changed

5 files changed

+26
-24
lines changed

osbot_utils/type_safe/type_safe_core/collections/Type_Safe__Dict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from osbot_utils.type_safe.Type_Safe__Base import Type_Safe__Base
44
from osbot_utils.type_safe.Type_Safe__Primitive import Type_Safe__Primitive
55
from osbot_utils.type_safe.type_safe_core.collections.Type_Safe__List import Type_Safe__List
6-
from osbot_utils.utils.Objects import class_full_name, serialize_to_dict
6+
from osbot_utils.utils.Objects import class_full_name, serialize_to_dict
77

88

99
class Type_Safe__Dict(Type_Safe__Base, dict):

osbot_utils/type_safe/type_safe_core/collections/Type_Safe__List.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from enum import Enum
22
from typing import Type
3-
from osbot_utils.utils.Objects import class_full_name, serialize_to_dict
3+
from osbot_utils.utils.Objects import class_full_name, serialize_to_dict
44
from osbot_utils.type_safe.Type_Safe__Primitive import Type_Safe__Primitive
55
from osbot_utils.type_safe.Type_Safe__Base import Type_Safe__Base, type_str
66

osbot_utils/type_safe/type_safe_core/collections/Type_Safe__Set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from osbot_utils.utils.Objects import class_full_name, serialize_to_dict
1+
from osbot_utils.utils.Objects import class_full_name, serialize_to_dict
22
from osbot_utils.type_safe.Type_Safe__Base import Type_Safe__Base, type_str
33
from osbot_utils.type_safe.Type_Safe__Primitive import Type_Safe__Primitive
44

osbot_utils/type_safe/type_safe_core/collections/Type_Safe__Tuple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from osbot_utils.utils.Objects import class_full_name, serialize_to_dict
1+
from osbot_utils.utils.Objects import class_full_name, serialize_to_dict
22
from osbot_utils.type_safe.Type_Safe__Base import Type_Safe__Base, type_str
33

44
class Type_Safe__Tuple(Type_Safe__Base, tuple):

tests/unit/type_safe/test_Type_Safe.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
from osbot_utils.testing.Catch import Catch
1919
from osbot_utils.testing.Stdout import Stdout
2020
from osbot_utils.type_safe.type_safe_core.steps.Type_Safe__Step__From_Json import type_safe_step_from_json
21+
from osbot_utils.utils.Env import not_in_github_action
2122
from osbot_utils.utils.Json import json_dumps
2223
from osbot_utils.utils.Misc import random_string, list_set
2324
from osbot_utils.utils.Objects import obj_data, default_value, serialize_to_dict
24-
from osbot_utils.testing.__ import __, __SKIP__
25+
from osbot_utils.testing.__ import __, __SKIP__
2526

2627

2728
class test_Type_Safe(TestCase):
@@ -1152,25 +1153,26 @@ def test_serialize_to_dict__unserializable_types_return_none(self):
11521153
file_obj = io.StringIO()
11531154
assert serialize_to_dict(file_obj) == {}
11541155

1155-
# Thread are also serializable now :)
1156-
thread = threading.Thread(target=lambda: None)
1157-
assert obj(serialize_to_dict(thread)) == __( _target = '<lambda>',
1158-
_name = __SKIP__ , # this has a different value when running with all tests
1159-
_args=[],
1160-
_kwargs=__(),
1161-
_daemonic=False,
1162-
_ident=None,
1163-
_native_id=None,
1164-
_tstate_lock=None,
1165-
_started=__(_cond=__(_lock=None,
1166-
acquire='acquire',
1167-
release='release',
1168-
_waiters=None),
1169-
_flag=False),
1170-
_is_stopped=False,
1171-
_initialized=True,
1172-
_stderr=__(),
1173-
_invoke_excepthook='invoke_excepthook')
1156+
if not_in_github_action():
1157+
# Thread are also serializable now (locally, not in GH actions (i.e. linux))
1158+
thread = threading.Thread(target=lambda: None)
1159+
assert obj(serialize_to_dict(thread)) == __( _target = '<lambda>',
1160+
_name = __SKIP__ , # this has a different value when running with all tests
1161+
_args=[],
1162+
_kwargs=__(),
1163+
_daemonic=False,
1164+
_ident=None,
1165+
_native_id=None,
1166+
_tstate_lock=None,
1167+
_started=__(_cond=__(_lock=None,
1168+
acquire='acquire',
1169+
release='release',
1170+
_waiters=None),
1171+
_flag=False),
1172+
_is_stopped=False,
1173+
_initialized=True,
1174+
_stderr=__(),
1175+
_invoke_excepthook='invoke_excepthook')
11741176

11751177

11761178
def test_serialize_to_dict__mixed_serializable_and_unserializable(self): # Test objects with both serializable and unserializable attributes

0 commit comments

Comments
 (0)