Skip to content

Commit 42a64a4

Browse files
jeremymanningclaude
andcommitted
Fix GitHub Actions test failures for widget mock classes
- Add missing observe() method to all mock widget classes (Text, IntText, Textarea, Dropdown) - Add layout attribute with display and border properties to all mock widgets - Fix cell_magic decorator mock to properly handle (self, line, cell) signature - Resolve AttributeError issues in CI/CD environments where IPython/ipywidgets unavailable Fixes 13 failing tests in GitHub Actions while maintaining 288 passing tests locally. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8a5dea3 commit 42a64a4

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

clustrix/notebook_magic.py

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ def magics_class(cls):
3535

3636
def cell_magic(name):
3737
def decorator(func):
38-
return func
38+
def wrapper(self, line, cell):
39+
return func(self, line, cell)
40+
return wrapper
3941

4042
return decorator
4143

@@ -54,36 +56,56 @@ def __init__(self, *args, **kwargs):
5456

5557
# Mock widgets module
5658
class widgets: # type: ignore
59+
class Layout:
60+
def __init__(self, *args, **kwargs):
61+
self.display = ""
62+
self.border = ""
63+
for key, value in kwargs.items():
64+
setattr(self, key, value)
65+
5766
class Dropdown:
5867
def __init__(self, *args, **kwargs):
5968
self.value = kwargs.get("value")
6069
self.options = kwargs.get("options", [])
70+
self.layout = widgets.Layout()
6171

6272
def observe(self, *args, **kwargs):
6373
pass
6474

6575
class Button:
6676
def __init__(self, *args, **kwargs):
67-
pass
77+
self.layout = widgets.Layout()
6878

6979
def on_click(self, *args, **kwargs):
7080
pass
7181

7282
class Text:
7383
def __init__(self, *args, **kwargs):
7484
self.value = kwargs.get("value", "")
85+
self.layout = widgets.Layout()
86+
87+
def observe(self, *args, **kwargs):
88+
pass
7589

7690
class IntText:
7791
def __init__(self, *args, **kwargs):
7892
self.value = kwargs.get("value", 0)
93+
self.layout = widgets.Layout()
94+
95+
def observe(self, *args, **kwargs):
96+
pass
7997

8098
class Textarea:
8199
def __init__(self, *args, **kwargs):
82100
self.value = kwargs.get("value", "")
101+
self.layout = widgets.Layout()
102+
103+
def observe(self, *args, **kwargs):
104+
pass
83105

84106
class Output:
85107
def __init__(self, *args, **kwargs):
86-
pass
108+
self.layout = widgets.Layout()
87109

88110
def clear_output(self, *args, **kwargs):
89111
pass
@@ -97,23 +119,23 @@ def __exit__(self, *args):
97119
class VBox:
98120
def __init__(self, *args, **kwargs):
99121
self.children = args[0] if args else []
122+
self.layout = widgets.Layout()
100123

101124
class HBox:
102125
def __init__(self, *args, **kwargs):
103126
self.children = args[0] if args else []
127+
self.layout = widgets.Layout()
104128

105129
class HTML:
106130
def __init__(self, *args, **kwargs):
107131
self.value = args[0] if args else ""
108-
109-
class Layout:
110-
def __init__(self, *args, **kwargs):
111-
pass
132+
self.layout = widgets.Layout()
112133

113134
class Accordion:
114135
def __init__(self, *args, **kwargs):
115136
self.children = args[0] if args else []
116137
self.selected_index = None
138+
self.layout = widgets.Layout()
117139

118140
def set_title(self, *args, **kwargs):
119141
pass

0 commit comments

Comments
 (0)