Skip to content

Commit b9ad9b5

Browse files
TST: fix pylint W1113 in MonteCarlo append rollback mock (#1110)
1 parent 605e47e commit b9ad9b5

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎tests/unit/simulation/test_monte_carlo.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,13 @@ def test_append_simulation_record_rolls_back_inputs_on_output_failure(tmp_path):
104104
original_open = builtins.open
105105
output_path = os.fspath(output_file)
106106

107-
def failing_output_open(file, mode="r", *args, **kwargs):
107+
def failing_output_open(*args, **kwargs):
108+
# Match builtins.open call shapes without keyword-before-vararg (W1113).
109+
file = args[0] if args else kwargs["file"]
110+
mode = args[1] if len(args) > 1 else kwargs.get("mode", "r")
108111
if os.fspath(file) == output_path and "a" in mode:
109112
raise OSError("no space left on device")
110-
return original_open(file, mode, *args, **kwargs)
113+
return original_open(*args, **kwargs)
111114

112115
with pytest.raises(OSError, match="no space left on device"):
113116
with patch("builtins.open", side_effect=failing_output_open):

0 commit comments

Comments
 (0)