def _is_update_avail(request_mocker, capsys, current, latest): "Set up the run manager and detect if the upgrade message is printed." api = internal.Api(load_settings=False, retry_timedelta=datetime.timedelta(0, 0, 50)) api.set_current_run_id(123) run = Run() run_manager = wandb.run_manager.RunManager(run) # Without this mocking, during other tests, the _check_update_available # function will throw a "mock not found" error, then silently fail without # output (just like it would in a normal network failure). response = b'{ "info": { "version": "%s" } }' % bytearray(latest, 'utf-8') request_mocker.register_uri('GET', 'https://pypi.org/pypi/wandb/json', content=response, status_code=200) run_manager._check_update_available(current) captured_out, captured_err = capsys.readouterr() print(captured_out, captured_err) return "To upgrade, please run:" in captured_err
def history(): with CliRunner().isolated_filesystem(): yield Run().history