File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 11import json
2+ import pytest
23from pathlib import Path
34from tempfile import TemporaryDirectory
45from uuid import uuid4
56
67from ..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
1224def 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"
Original file line number Diff line number Diff 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
5353def 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' )
You can’t perform that action at this time.
0 commit comments