Skip to content

Commit 0d1facd

Browse files
- fixed renamed argument;
1 parent 031bb4b commit 0d1facd

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/pytest_cleanslate/reduce.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,12 @@ def main():
239239
failed = results.get_first_failed()
240240
if failed is None:
241241
print("No tests failed!", flush=True)
242-
with args.to.open("w") as f:
243-
json.dump({
244-
'failed': failed,
245-
'error': 'No tests failed',
246-
}, f)
242+
if args.save_to:
243+
with args.save_to.open("w") as f:
244+
json.dump({
245+
'failed': failed,
246+
'error': 'No tests failed',
247+
}, f)
247248
return 1
248249

249250
is_module = results.is_module(failed)
@@ -262,11 +263,12 @@ def main():
262263

263264
if solo.get_outcome(failed) != 'passed':
264265
print("That also fails by itself!", flush=True)
265-
with args.to.open("w") as f:
266-
json.dump({
267-
'failed': failed,
268-
'error': f'{"Module" if is_module else "Test"} also fails by itself',
269-
}, f)
266+
if args.save_to:
267+
with args.save_to.open("w") as f:
268+
json.dump({
269+
'failed': failed,
270+
'error': f'{"Module" if is_module else "Test"} also fails by itself',
271+
}, f)
270272
return 1
271273

272274
tests = results.get_tests()
@@ -290,8 +292,8 @@ def main():
290292
print(f" tests: {tests}")
291293
print(flush=True)
292294

293-
if args.to:
294-
with args.to.open("w") as f:
295+
if args.save_to:
296+
with args.save_to.open("w") as f:
295297
json.dump({
296298
'failed': failed,
297299
'modules': modules,

0 commit comments

Comments
 (0)