def test_check_update_mock_random_no_output(capsys): expected_result = "" import jovian jovian.utils.latest.__version__ = '0.0.1' check_update() captured = capsys.readouterr() assert captured.out.strip() == expected_result
def test_check_update_mock_random(capsys): expected_result = """[jovian] Update Available: 0.0.1 --> 0.0.2 [jovian] Run `pip install jovian --upgrade` to upgrade""" import jovian jovian.utils.latest.__version__ = '0.0.1' check_update() captured = capsys.readouterr() assert captured.out.strip() == expected_result
def test_check_update(probability, expected_result, random_val, capsys): with mock.patch("jovian.utils.latest.random", return_value=random_val): import jovian jovian.utils.latest.__version__ = '0.0.1' if probability: check_update(probability) else: check_update() captured = capsys.readouterr() assert captured.out.strip() == expected_result
def _initialize_jovian(): """Initialize by setting the notebook name and checking for updates""" set_notebook_name() check_update()