MCPcopy Create free account
hub / github.com/PyVRP/PyVRP / test_should_print_false_no_output

Function test_should_print_false_no_output

tests/test_ProgressPrinter.py:107–128  ·  view source on GitHub ↗

Tests that disabling printing works.

(ok_small, caplog)

Source from the content-addressed store, hash-verified

105
106
107def test_should_print_false_no_output(ok_small, caplog):
108 """
109 Tests that disabling printing works.
110 """
111 sol = Solution(ok_small, [[1, 2, 3, 4]])
112 cost_eval = CostEvaluator([20], 6, 6)
113
114 stats = Statistics()
115 stats.collect(sol, sol, sol, cost_eval)
116
117 # Set up the progress printer, call all its methods, and then check that
118 # the output captured on stdout is empty.
119 printer = ProgressPrinter(should_print=False, display_interval=0.0)
120 printer.start(ok_small)
121 printer.iteration(stats=stats)
122 printer.restart()
123
124 rng = RandomNumberGenerator(42)
125 sol = Solution.make_random(ok_small, rng)
126 printer.end(result=Result(sol, stats, 25, 0.05))
127
128 assert_equal(caplog.text, "")

Callers

nothing calls this directly

Calls 11

collectMethod · 0.95
startMethod · 0.95
iterationMethod · 0.95
restartMethod · 0.95
endMethod · 0.95
SolutionClass · 0.90
CostEvaluatorClass · 0.90
StatisticsClass · 0.90
ProgressPrinterClass · 0.90
ResultClass · 0.90

Tested by

no test coverage detected