()
| 225 | @pytest.mark.skipif("not bokeh") |
| 226 | @pytest.mark.skipif("not psutil") |
| 227 | def test_resource_profiler_plot(): |
| 228 | with ResourceProfiler(dt=0.01) as rprof: |
| 229 | get(dsk2, "c") |
| 230 | p = rprof.visualize( |
| 231 | width=500, |
| 232 | height=300, |
| 233 | tools="hover", |
| 234 | title="Not the default", |
| 235 | show=False, |
| 236 | save=False, |
| 237 | ) |
| 238 | if BOKEH_VERSION().major < 3: |
| 239 | assert p.plot_width == 500 |
| 240 | assert p.plot_height == 300 |
| 241 | else: |
| 242 | assert p.width == 500 |
| 243 | assert p.height == 300 |
| 244 | assert len(p.tools) == 1 |
| 245 | assert isinstance(p.tools[0], bokeh.models.HoverTool) |
| 246 | assert p.title.text == "Not the default" |
| 247 | |
| 248 | # Test with empty and one point, checking for errors |
| 249 | rprof.clear() |
| 250 | for results in [[], [(1.0, 0, 0)]]: |
| 251 | rprof.results = results |
| 252 | rprof.start_time = 0.0 |
| 253 | rprof.end_time = 1.0 |
| 254 | with warnings.catch_warnings(record=True) as record: |
| 255 | p = rprof.visualize(show=False, save=False) |
| 256 | assert not record |
| 257 | # Check bounds are valid |
| 258 | assert p.x_range.start == 0 |
| 259 | assert p.x_range.end == 1 |
| 260 | assert p.y_range.start == 0 |
| 261 | assert p.y_range.end == 100 |
| 262 | assert p.extra_y_ranges["memory"].start == 0 |
| 263 | assert p.extra_y_ranges["memory"].end == 100 |
| 264 | |
| 265 | |
| 266 | @pytest.mark.skipif("not bokeh") |
nothing calls this directly
no test coverage detected
searching dependent graphs…