Skip to content

Commit 29ee014

Browse files
committed
Copy testing options when used in model arguments to prevent changes from persisting between tests.
Don't skip the wait in recv filter test for ForkComm as the filtering takes places on the receive call, even for async comms
1 parent 797b867 commit 29ee014

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

tests/communication/test_ForkComm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ def test_send_recv_filter_recv_filter(self, filtered_comms,
117117
recv_comm, polling_interval,
118118
do_send_recv):
119119
r"""Test send/recv with filter that blocks recv."""
120-
# Wait if not async?
121120
do_send_recv(send_comm, recv_comm, msg_filter_recv,
122121
recv_params={'message': recv_comm.empty_obj_recv,
123-
'skip_wait': True,
122+
# Don't need to skip since
123+
# filter is evaluated after
124+
# receipt for fork comm
125+
'skip_wait': False,
124126
'count': 1,
125127
'kwargs': {'timeout': 10 * polling_interval}})
126128

tests/drivers/test_CompiledModelDriver.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,21 @@ def compiler(self, python_class):
192192
def instance_args(self, name, source, testing_options, compiler,
193193
is_installed):
194194
r"""Arguments for a new instance of the tested class."""
195-
return tuple([name, ([compiler.get_output_file(source[0])]
196-
+ testing_options.get('args', []))])
195+
return tuple(
196+
[name, ([compiler.get_output_file(source[0])]
197+
+ copy.deepcopy(
198+
testing_options.get('args', [])))])
197199

198200
@pytest.fixture
199201
def instance_kwargs(self, testing_options, timeout, working_dir,
200202
polling_interval, namespace, source):
201203
r"""Keyword arguments for a new instance of the tested class."""
202-
return dict(testing_options.get('kwargs', {}),
203-
yml={'working_dir': working_dir},
204-
timeout=timeout, sleeptime=polling_interval,
205-
namespace=namespace, source_files=source)
204+
return dict(
205+
copy.deepcopy(
206+
testing_options.get('kwargs', {})),
207+
yml={'working_dir': working_dir},
208+
timeout=timeout, sleeptime=polling_interval,
209+
namespace=namespace, source_files=source)
206210

207211
@pytest.fixture
208212
def run_model_instance_kwargs(self):

tests/drivers/test_ModelDriver.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ def working_dir(self, source):
8888
@pytest.fixture
8989
def instance_args(self, name, source, testing_options):
9090
r"""Arguments for a new instance of the tested class."""
91-
return tuple([name, source + testing_options.get('args', [])])
91+
return tuple(
92+
[name, source + copy.deepcopy(
93+
testing_options.get('args', []))])
9294

9395
@pytest.fixture(scope="class")
9496
def python_class_installed(self, python_class):

0 commit comments

Comments
 (0)