Skip to content

Commit efef144

Browse files
Python2 decoding fix. Skip IOC init on Windows.
1 parent e936368 commit efef144

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

tests/test_records.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
from softioc.device_core import RecordLookup
1414
import sim_records
1515

16+
requires_cothread = pytest.mark.skipif(
17+
sys.platform.startswith("win"),
18+
reason="Cothread doesn't work on windows"
19+
)
20+
1621

1722
def _clear_records():
1823
# Remove any records created at epicsdbbuilder layer
@@ -154,12 +159,12 @@ def record_value_asserts(
154159
else:
155160
# Python2 handles UTF-8 differently so needs extra encoding
156161
if sys.version_info < (3,) and expected_type == str:
157-
expected_value = expected_value.decode(errors="replace")
162+
expected_value = expected_value.decode("utf-8", errors="replace")
158163

159164
assert actual_value == expected_value
160165
assert type(actual_value) == expected_type
161166

162-
def test_value_retrieval_pre_init_set(
167+
def test_value_pre_init_set(
163168
clear_records,
164169
record_values):
165170
"""Test that records provide the expected values on get calls when using
@@ -254,18 +259,21 @@ def run_test_function(record_values, set_enum):
254259
process.terminate()
255260
process.join(timeout=3)
256261

262+
@requires_cothread
257263
def test_value_post_init_set(record_values):
258264
"""Test that records provide the expected values on get calls when using
259265
.set() before IOC initialisation and .get() after initialisation"""
260266

261267
run_test_function(record_values, SetValueEnum.SET_BEFORE_INIT)
262268

269+
@requires_cothread
263270
def test_value_post_init_initial_value(record_values):
264271
"""Test that records provide the expected values on get calls when using
265272
initial_value during record creation and .get() after IOC initialisation"""
266273

267274
run_test_function(record_values, SetValueEnum.INITIAL_VALUE)
268275

276+
@requires_cothread
269277
def test_value_post_init_set_after_init(record_values):
270278
"""Test that records provide the expected values on get calls when using
271279
.set() and .get() after IOC initialisation"""

0 commit comments

Comments
 (0)