def test_log_git_verbose(mock_api_post_block, capsys): data = { 'branch': 'sample_branch', 'commit': 'sample_commit_hash', 'remote': 'https://github.com/rohitsanj/fakerepo' } log_git(data) captured = capsys.readouterr() expected_result = '[jovian] Git logged.' assert expected_result == captured.out.strip()
def _perform_git_commit(filename, git_commit, git_message): if git_commit and git.is_git(): reset('git') # resets git commit info git.commit(git_message) log('Git repository identified. Performing git commit...') git_info = { 'repository': git.get_remote(), 'commit': git.get_current_commit(), 'filename': filename, 'path': git.get_relative_path(), 'branch': git.get_branch() } log_git(git_info, verbose=False)
def test_log_git(self, mock_api_post_block): data = { 'branch': 'sample_branch', 'commit': 'sample_commit_hash', 'remote': 'https://github.com/rohitsanj/fakerepo' } expected_result = [('fake_slug_metrics_1', 'metrics', {}), ('fake_slug_metrics_2', 'metrics', {}), ('fake_slug_hyperparams_1', 'hyperparams', {}), ('fake_slug_hyperparams_2', 'hyperparams', {}), ('fake_slug_3', 'git', data)] log_git(data) self.assertEqual(jovian.utils.records._data_blocks, expected_result)