test(solver): add  test case for tqdm in solver
+import sys
import pytest
import random
import torch
@@ -162,6 +163,23 @@ def test_invalid_get_internals(solver):
solver.get_internals(['generator'], return_type='bad type')
+def test_tqdm(solver, capfd):
+ solver.fit(max_epochs=20, tqdm_file=sys.stdout)
+ stdout, stderr = capfd.readouterr()
+ assert 'Training Progress: ' in stdout
+ assert 'Training Progress: ' not in stderr
+
+ solver.fit(max_epochs=20, tqdm_file=sys.stderr)
+ stdout, stderr = capfd.readouterr()
+ assert 'Training Progress: ' not in stdout
+ assert 'Training Progress: ' in stderr
+
+ solver.fit(max_epochs=20, tqdm_file=None)
+ stdout, stderr = capfd.readouterr()
+ assert 'Training Progress: ' not in stdout
+ assert 'Training Progress: ' not in stderr
+
+
def test_generic_solver(solver):
solver.fit(1)
