Skip to content

Commit 9bfc846

Browse files
committed
Fixed failing unit tests
1 parent eb3b6e9 commit 9bfc846

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

jupyter_rtc_core/tests/test_output_processor.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
import json
2+
import pytest
23
from pathlib import Path
34
from tempfile import TemporaryDirectory
45
from uuid import uuid4
56

67
from ..outputs import OutputProcessor, OutputsManager
78

8-
class TestOutputProcessor(OutputProcessor):
99

10-
settings = {}
10+
class OutputProcessorForTest(OutputProcessor):
11+
"""Test subclass of OutputProcessor that overrides the settings property."""
12+
_test_settings = {}
13+
14+
@property
15+
def settings(self):
16+
"""Override the settings property to return a test dictionary."""
17+
return self._test_settings
18+
19+
@pytest.fixture
20+
def output_processor():
21+
"""Fixture that returns an instance of TestOutputProcessor."""
22+
return OutputProcessorForTest()
1123

1224
def create_incoming_message(cell_id):
1325
msg_id = str(uuid4())
@@ -22,10 +34,10 @@ def test_instantiation():
2234
op = OutputProcessor()
2335
assert isinstance(op, OutputProcessor)
2436

25-
def test_incoming_message():
37+
def test_incoming_message(output_processor):
2638
"""Test incoming message processing."""
2739
with TemporaryDirectory() as td:
28-
op = TestOutputProcessor()
40+
op = output_processor
2941
om = OutputsManager()
3042
op.settings["outputs_manager"] = om
3143
op.outputs_path = Path(td) / "outputs"

jupyter_rtc_core/tests/test_outputs_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_stream():
4747
file_id = str(uuid4())
4848
cell_id = str(uuid4())
4949
for s in streams:
50-
op.write_stream(file_id, cell_id, s)
50+
op.write(file_id, cell_id, s)
5151
assert op.get_stream(file_id, cell_id) == text
5252

5353
def test_display_data():
@@ -90,4 +90,4 @@ def file_not_found():
9090
with pytest.raises(FileNotFoundError):
9191
op.get_output('a','b',0)
9292
with pytest.raises(FileNotFoundError):
93-
op.get_stream('a','b')
93+
op.get_stream('a','b')

0 commit comments

Comments
 (0)