def test_24_check_sampling_flag_after_checkout(self): entity = 'dataset' self.set_up_checkout(entity) number_of_files_in_workspace = 4 self.assertNotIn( ERROR_MESSAGE, check_output(MLGIT_CHECKOUT % (entity, 'computer-vision__images__dataset-ex__1'))) workspace = os.path.join(self.tmp_dir, entity, 'computer-vision', 'images', entity + '-ex') create_file(workspace, 'new_file', '0', file_path='') populate_entity_with_new_data(self, entity) self.assertNotIn( ERROR_MESSAGE, check_output( MLGIT_CHECKOUT % ('dataset', 'computer-vision__images__dataset-ex__1') + ' --sample-type=random --sampling=2:3 --seed=3')) self.check_amount_of_files('dataset', number_of_files_in_workspace) self.assertNotIn( ERROR_MESSAGE, check_output( MLGIT_CHECKOUT % ('dataset', 'computer-vision__images__dataset-ex__2'))) self.assertFalse(self.check_sampling_flag('dataset'))
def test_28_checkout_entity_with_ignore_file(self): entity = DATASETS init_repository(entity, self) workspace = os.path.join(self.tmp_dir, DATASETS, DATASET_NAME) os.mkdir(os.path.join(workspace, 'data')) create_file(workspace, 'image.png', '0') create_file(workspace, 'file1', '0') create_ignore_file(workspace) self.assertNotIn( ERROR_MESSAGE, check_output(MLGIT_ADD % (DATASETS, DATASET_NAME, '--bumpversion'))) self.assertNotIn( ERROR_MESSAGE, check_output(MLGIT_COMMIT % (DATASETS, DATASET_NAME, ''))) self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_PUSH % (DATASETS, DATASET_NAME))) clear(os.path.join(self.tmp_dir, ML_GIT_DIR, entity)) clear(workspace) mlgit_ignore_file_path = os.path.join(workspace, MLGIT_IGNORE_FILE_NAME) self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_ENTITY_INIT % entity)) self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_CHECKOUT % (entity, DATASET_NAME))) self.assertTrue(os.path.exists(mlgit_ignore_file_path)) self.assertTrue( os.path.exists(os.path.join(workspace, 'data', 'file1'))) self.assertFalse( os.path.exists(os.path.join(workspace, 'data', 'image.png')))
def set_up_test(self, repo_type=MODELS): self.TAG_TIMES = [] entity_name = '{}-ex'.format(repo_type) entity_init(repo_type, self) data_path = os.path.join(self.tmp_dir, repo_type, entity_name) create_file(data_path, 'file', '0', '') metrics_options = '--metric Accuracy 10 --metric Recall 10' self.assertNotIn( ERROR_MESSAGE, check_output(MLGIT_ADD % (repo_type, entity_name, metrics_options))) self.assertNotIn( ERROR_MESSAGE, check_output(MLGIT_COMMIT % (repo_type, entity_name, ''))) self._git_commit_time() metrics_options = '--metric Accuracy 20 --metric Recall 20' workspace = os.path.join(self.tmp_dir, repo_type, entity_name) os.makedirs(os.path.join(workspace, 'data')) create_file(workspace, 'file1', '0') self.assertNotIn( ERROR_MESSAGE, check_output(MLGIT_ADD % (repo_type, entity_name, metrics_options))) self.assertNotIn( ERROR_MESSAGE, check_output(MLGIT_COMMIT % (repo_type, entity_name, ' --version=2'))) self._git_commit_time()
def test_02_status_after_put_on_new_file_in_dataset_with_directory(self): self.set_up_status('dataset') data_path = os.path.join(self.tmp_dir, 'dataset', 'dataset-ex', 'data') os.makedirs(data_path, exist_ok=True) create_file(data_path, 'file2', '0', '') self.assertRegex(check_output(MLGIT_STATUS_DIRECTORY % ('dataset', 'dataset-ex', 'data')), r'Changes to be committed:\s+Untracked files:(\s|.)*file2(\s|.)*')
def _create_entity_with_mutability(self, entity_type, mutability_type): init_repository(entity_type, self) workspace = os.path.join(self.tmp_dir, entity_type, entity_type + '-ex') create_spec(self, entity_type, self.tmp_dir, 1, mutability_type) os.makedirs(os.path.join(workspace, 'data')) create_file(workspace, 'file1', '0') self.assertNotIn( ERROR_MESSAGE, check_output(MLGIT_ADD % (entity_type, entity_type + '-ex', ''))) self.assertIn( messages[17] % (os.path.join(self.tmp_dir, ML_GIT_DIR, entity_type, 'metadata'), os.path.join('computer-vision', 'images', entity_type + '-ex')), check_output(MLGIT_COMMIT % (entity_type, entity_type + '-ex', ''))) self.assertNotIn( ERROR_MESSAGE, check_output(MLGIT_PUSH % (entity_type, entity_type + '-ex'))) clear(os.path.join(self.tmp_dir, ML_GIT_DIR)) clear(workspace) clear(os.path.join(self.tmp_dir, entity_type))
def test_02_push_file(self): entity_type = DATASETS self._create_entity_with_mutability(entity_type, STRICT) self._checkout_entity(entity_type) self.assertFalse( os.path.exists( os.path.join(self.tmp_dir, DATASETS, DATASET_NAME, 'data', 'file1'))) self.check_bare_checkout(entity_type) data_path = os.path.join(self.tmp_dir, entity_type, entity_type + '-ex') os.mkdir(os.path.join(data_path, 'data')) create_file(data_path, 'file2', '1') self._push_files(entity_type) self._clear_path() self._checkout_entity(entity_type, tag='computer-vision__images__' + entity_type + '-ex__2', bare=False) file2 = os.path.join(self.tmp_dir, entity_type, entity_type + '-ex', 'data', 'file2') self.assertTrue( os.path.exists( os.path.join(self.tmp_dir, DATASETS, DATASET_NAME, 'data', 'file1'))) self.assertTrue(os.path.exists(file2))
def test_05_hard_with_data_in_subpath(self): entity = DATASETS subpath = 'data' init_repository(entity, self) first_commit_file_name = 'file1' data_path = os.path.join(entity, entity+'-ex', subpath) ensure_path_exists(data_path) create_file(data_path, first_commit_file_name, '0', '') self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_ADD % (entity, entity+'-ex', '--bumpversion'))) self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_COMMIT % (entity, entity+'-ex', ''))) second_commit_file_name = 'file2' create_file(data_path, second_commit_file_name, '1', '') self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_ADD % (entity, entity+'-ex', '--bumpversion'))) self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_COMMIT % (entity, entity+'-ex', ''))) self.assertTrue(os.path.exists(os.path.join(data_path, first_commit_file_name))) self.assertTrue(os.path.exists(os.path.join(data_path, second_commit_file_name))) self.assertIn(output_messages['INFO_INITIALIZING_RESET'] % ('--hard', 'HEAD~1'), check_output(MLGIT_RESET % (entity, entity+'-ex') + ' --hard --reference=head~1')) self.assertTrue(os.path.exists(os.path.join(data_path, first_commit_file_name))) self.assertFalse(os.path.exists(os.path.join(data_path, second_commit_file_name))) self.assertRegex(check_output(MLGIT_STATUS % (entity, entity+'-ex')), DATASET_UNPUBLISHED_COMMITS_INFO_REGEX.format(unpublished_commits=1, pluralize_char='') + DATASET_PUSH_INFO_REGEX + r'Changes to be committed:\s+' r'New file: datasets-ex.spec') self._check_dir(self.dataset_tag)
def test_05_checkout_bare_in_older_tag(self): entity_type = 'dataset' self._create_entity_with_mutability(entity_type, 'strict') data_path = os.path.join(self.tmp_dir, entity_type, 'computer-vision', 'images', entity_type+'-ex') self._clear_path() self._checkout_entity(entity_type, tag='computer-vision__images__'+entity_type+'-ex__1') os.mkdir(os.path.join(data_path, 'data')) create_file(data_path, 'file3', '1') spec_path = os.path.join(self.tmp_dir, 'dataset', 'computer-vision', 'images', 'dataset-ex', 'dataset-ex.spec') with open(spec_path, 'r') as y: spec = yaml_processor.load(y) with open(spec_path, 'w') as y: spec['dataset']['version'] = 2 yaml_processor.dump(spec, y) self._push_files(entity_type) self._clear_path() self._checkout_entity(entity_type, tag='computer-vision__images__'+entity_type+'-ex__3', bare=False) file_path = os.path.join(self.tmp_dir, entity_type, 'computer-vision', 'images', entity_type+'-ex', 'data') self.assertTrue(os.path.exists(os.path.join(file_path, 'file1'))) self.assertTrue(os.path.exists(os.path.join(file_path, 'file3')))
def test_04_status_after_put_more_than_one_file_in_dataset_with_invalid_directory(self): self.set_up_status('dataset') data_path = os.path.join(self.tmp_dir, 'dataset', 'dataset-ex', 'data') os.makedirs(data_path, exist_ok=True) create_file(data_path, 'file5', '0', '') create_file(data_path, 'file6', '0', '') self.assertIn(output_messages['ERROR_INVALID_STATUS_DIRECTORY'], check_output(MLGIT_STATUS_DIRECTORY % ('dataset', 'dataset-ex', 'invalid')))
def test_04_commit_command_with_version(self): init_repository(DATASETS, self) create_spec(self, DATASETS, self.tmp_dir) workspace = os.path.join(self.tmp_dir, DATASETS, DATASET_NAME) os.makedirs(os.path.join(workspace, 'data')) create_file(workspace, 'file1', '0') self.assertIn(output_messages['INFO_ADDING_PATH'] % DATASETS, check_output(MLGIT_ADD % (DATASETS, DATASET_NAME, ""))) self.assertIn( output_messages['INFO_COMMIT_REPO'] % (os.path.join( self.tmp_dir, ML_GIT_DIR, DATASETS, 'metadata'), DATASET_NAME), check_output(MLGIT_COMMIT % (DATASETS, DATASET_NAME, ''))) create_file(workspace, 'file2', '1') self.assertIn(output_messages['INFO_ADDING_PATH'] % DATASETS, check_output(MLGIT_ADD % (DATASETS, DATASET_NAME, ""))) self.assertIn( output_messages['ERROR_INVALID_VALUE_FOR'] % ('--version', '-10'), check_output(MLGIT_COMMIT % (DATASETS, DATASET_NAME, ' --version=-10'))) self.assertIn( output_messages['ERROR_INVALID_VALUE_FOR'] % ('--version', 'test'), check_output(MLGIT_COMMIT % (DATASETS, DATASET_NAME, '--version=test'))) self.assertIn( output_messages['INFO_COMMIT_REPO'] % (os.path.join( self.tmp_dir, ML_GIT_DIR, DATASETS, 'metadata'), DATASET_NAME), check_output(MLGIT_COMMIT % (DATASETS, DATASET_NAME, '--version=2')))
def test_10_add_command_with_metric_file(self): repo_type = MODELS entity_name = '{}-ex'.format(repo_type) self.set_up_add(repo_type) create_spec(self, repo_type, self.tmp_dir) workspace = os.path.join(self.tmp_dir, repo_type, entity_name) os.makedirs(os.path.join(workspace, 'data')) create_file(workspace, 'file1', '0') csv_file = os.path.join(self.tmp_dir, 'metrics.csv') self.create_csv_file(csv_file, {'Accuracy': 1, 'Recall': 2}) metrics_options = '--metrics-file="{}"'.format(csv_file) self.assertIn( output_messages['INFO_ADDING_PATH'] % repo_type, check_output(MLGIT_ADD % (repo_type, entity_name, metrics_options))) index = os.path.join(ML_GIT_DIR, repo_type, 'index', 'metadata', entity_name, 'INDEX.yaml') self._check_index(index, ['data/file1'], []) with open(os.path.join(workspace, entity_name + '.spec')) as spec: spec_file = yaml_processor.load(spec) spec_key = get_spec_key(repo_type) metrics = spec_file[spec_key].get('metrics', {}) self.assertFalse(metrics == {}) self.assertTrue(metrics['Accuracy'] == 1) self.assertTrue(metrics['Recall'] == 2)
def test_09_add_command_with_metric_for_wrong_entity(self): repo_type = DATASETS self.set_up_add() create_spec(self, repo_type, self.tmp_dir) workspace = os.path.join(self.tmp_dir, repo_type, DATASET_NAME) os.makedirs(os.path.join(workspace, 'data')) create_file(workspace, 'file1', '0') metrics_options = '--metric Accuracy 1 --metric Recall 2' self.assertIn( output_messages['INFO_ADDING_PATH'] % repo_type, check_output(MLGIT_ADD % (repo_type, DATASET_NAME, metrics_options))) index = os.path.join(ML_GIT_DIR, repo_type, 'index', 'metadata', DATASET_NAME, 'INDEX.yaml') self._check_index(index, ['data/file1'], []) with open(os.path.join(workspace, DATASET_NAME + '.spec')) as spec: spec_file = yaml_processor.load(spec) spec_key = get_spec_key(repo_type) metrics = spec_file[spec_key].get('metrics', {}) self.assertTrue(metrics == {})
def test_05_hard_with_data_in_subpath(self): entity = DATASETS subpath = 'data' init_repository(entity, self) first_commit_file_name = 'file1' data_path = os.path.join(entity, entity+'-ex', subpath) ensure_path_exists(data_path) create_file(data_path, first_commit_file_name, '0', '') self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_ADD % (entity, entity+'-ex', '--bumpversion'))) self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_COMMIT % (entity, entity+'-ex', ''))) second_commit_file_name = 'file2' create_file(data_path, second_commit_file_name, '1', '') self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_ADD % (entity, entity+'-ex', '--bumpversion'))) self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_COMMIT % (entity, entity+'-ex', ''))) self.assertTrue(os.path.exists(os.path.join(data_path, first_commit_file_name))) self.assertTrue(os.path.exists(os.path.join(data_path, second_commit_file_name))) self.assertIn(output_messages['INFO_INITIALIZING_RESET'] % ('--hard', 'HEAD~1'), check_output(MLGIT_RESET % (entity, entity+'-ex') + ' --hard --reference=head~1')) self.assertTrue(os.path.exists(os.path.join(data_path, first_commit_file_name))) self.assertFalse(os.path.exists(os.path.join(data_path, second_commit_file_name))) self.assertRegex(check_output(MLGIT_STATUS % (entity, entity+'-ex')), r'Changes to be committed:\n\tNew file: datasets-ex.spec\n\nUntracked files:\n\nCorrupted files') self._check_dir(self.dataset_tag)
def set_up_checkout(self, entity): metadata_path = os.path.join(self.tmp_dir, ML_GIT_DIR, entity, 'metadata') workspace = os.path.join(self.tmp_dir, entity) self.set_up_status('dataset') data_path = os.path.join(workspace, 'dataset-ex', 'data') os.makedirs(data_path, exist_ok=True) create_file(data_path, 'file', '0', '') create_file(data_path, 'file2', '0', '') self.assertIn(messages[13] % 'dataset', check_output(MLGIT_ADD % ('dataset', 'dataset-ex', ''))) self.assertIn( messages[17] % (metadata_path, os.path.join('computer-vision', 'images', entity + '-ex')), check_output(MLGIT_COMMIT % (entity, entity + '-ex', ''))) HEAD = os.path.join(self.tmp_dir, ML_GIT_DIR, entity, 'refs', entity + '-ex', 'HEAD') self.assertTrue(os.path.exists(HEAD)) self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_PUSH % (entity, entity + '-ex'))) clear(os.path.join(self.tmp_dir, ML_GIT_DIR, entity)) clear(workspace) self.assertIn( messages[8] % (os.path.join(self.tmp_dir, GIT_PATH), os.path.join(self.tmp_dir, ML_GIT_DIR, entity, 'metadata')), check_output(MLGIT_ENTITY_INIT % entity))
def test_01_status_after_put_on_new_file_in_dataset(self): self.set_up_status(DATASETS) create_file(os.path.join(self.tmp_dir, DATASETS, DATASET_NAME), 'file', '0', '') self.assertRegex( check_output(MLGIT_STATUS % (DATASETS, DATASET_NAME)), r'Changes to be committed:\s+Untracked files:\s+datasets-ex\.spec\s+file' )
def _create_entity_with_mutability(self, entity_type, mutability_type): init_repository(entity_type, self) workspace = os.path.join(self.tmp_dir, entity_type, entity_type + '-ex') create_spec(self, entity_type, self.tmp_dir, 1, mutability_type) os.makedirs(os.path.join(workspace, 'data')) create_file(workspace, 'file1', '0') self._push_files(entity_type, '') self._clear_path()
def test_23_add_after_checkout_with_sample(self): self.set_up_checkout('dataset') self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_CHECKOUT % ('dataset', 'computer-vision__images__dataset-ex__1') + ' --sample-type=random --sampling=2:3 --seed=3')) self.check_amount_of_files('dataset', 4) workspace = os.path.join(self.tmp_dir, 'dataset', 'computer-vision', 'images', 'dataset-ex') create_file(workspace, 'new_file', '0', file_path='') self.assertIn(messages[95], check_output(MLGIT_ADD % ('dataset', 'dataset-ex', '')))
def test_01_status_after_put_on_new_file_in_dataset(self): self.set_up_status(DATASETS) data_path = os.path.join(self.tmp_dir, DATASETS, DATASET_NAME, 'data') os.makedirs(data_path, exist_ok=True) create_file(data_path, 'file', '0', '') self.assertRegex( check_output(MLGIT_STATUS_SHORT % (DATASETS, DATASET_NAME)), r'Changes to be committed:\s+Untracked files:(\s|.)*data(\\|/)file(\s|.)*' )
def _create_file_with_same_path(self, entity_type='dataset'): entity_path = os.path.join(self.tmp_dir, entity_type, 'computer-vision', 'images', entity_type+'-ex') file = os.path.join(self.tmp_dir, entity_path, 'data', 'file1') self.assertFalse(os.path.exists(file)) os.mkdir(os.path.join(self.tmp_dir, entity_path, 'data')) create_file(entity_path, 'file1', '1') self.assertTrue(os.path.exists(file))
def _create_file_with_same_path(self, entity_type=DATASETS): entity_path = os.path.join(self.tmp_dir, entity_type, entity_type+'-ex') file = os.path.join(self.tmp_dir, entity_path, 'data', 'file1') self.assertFalse(os.path.exists(file)) os.mkdir(os.path.join(self.tmp_dir, entity_path, 'data')) create_file(entity_path, 'file1', '1') self.assertTrue(os.path.exists(file))
def test_03_hard_with_HEAD(self): self.set_up_reset() create_file(os.path.join(DATASETS, DATASET_NAME), 'file3', '0', '') check_output(MLGIT_ADD % (DATASETS, DATASET_NAME, '--bumpversion')) self.assertIn(output_messages['INFO_INITIALIZING_RESET'] % ('--hard', 'HEAD'), check_output(MLGIT_RESET % (DATASETS, DATASET_NAME) + ' --hard --reference=head')) self.assertRegex(check_output(MLGIT_STATUS % (DATASETS, DATASET_NAME)), r'Changes to be committed:\n\tNew file: datasets-ex.spec\n\nUntracked files:\n\nCorrupted files:') self._check_dir('computer-vision__images__datasets-ex__3')
def test_01_status_after_put_on_new_file_in_dataset(self): self.set_up_status(DATASETS) create_file(os.path.join(self.tmp_dir, DATASETS, DATASET_NAME), 'file', '0', '') self.assertRegex( check_output(MLGIT_STATUS % (DATASETS, DATASET_NAME)), DATASET_NO_COMMITS_INFO_REGEX + r'Untracked files:\s+' + DATASET_ADD_INFO_REGEX + r'datasets-ex\.spec\s+' r'file')
def test_02_status_after_put_more_than_one_file_in_dataset(self): self.set_up_status('dataset') data_path = os.path.join(self.tmp_dir, 'dataset', 'dataset-ex', 'data') os.makedirs(data_path, exist_ok=True) create_file(data_path, 'file', '0', '') create_file(data_path, 'file2', '0', '') self.assertRegex( check_output(MLGIT_STATUS_SHORT % ('dataset', 'dataset-ex')), r'Changes to be committed:\s+Untracked files:(\s|.)*data/\t->\t2 FILES(\s|.)*' )
def set_up_reset(self): init_repository(DATASETS, self) create_file(os.path.join(DATASETS, DATASET_NAME), 'file1', '0', '') self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_ADD % (DATASETS, DATASET_NAME, '--bumpversion'))) self.assertIn(output_messages['INFO_COMMIT_REPO'] % (os.path.join(self.tmp_dir, ML_GIT_DIR, DATASETS, 'metadata'), DATASET_NAME), check_output(MLGIT_COMMIT % (DATASETS, DATASET_NAME, ''))) create_file(os.path.join(DATASETS, DATASET_NAME), 'file2', '0', '') self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_ADD % (DATASETS, DATASET_NAME, '--bumpversion'))) self.assertIn(output_messages['INFO_COMMIT_REPO'] % (os.path.join(self.tmp_dir, ML_GIT_DIR, DATASETS, 'metadata'), DATASET_NAME), check_output(MLGIT_COMMIT % (DATASETS, DATASET_NAME, '')))
def test_02_status_after_put_on_new_file_in_dataset_with_directory(self): self.set_up_status(DATASETS) data_path = os.path.join(self.tmp_dir, DATASETS, DATASET_NAME, 'data') os.makedirs(data_path, exist_ok=True) create_file(data_path, 'file2', '0', '') self.assertRegex( check_output(MLGIT_STATUS_DIRECTORY % (DATASETS, DATASET_NAME, 'data')), DATASET_NO_COMMITS_INFO_REGEX + r'Untracked files:\s+' + DATASET_ADD_INFO_REGEX + r'data(\\|/)file2')
def test_03_status_after_add_command_in_dataset(self): self.set_up_status(DATASETS) data_path = os.path.join(self.tmp_dir, DATASETS, DATASET_NAME, 'data') os.makedirs(data_path, exist_ok=True) create_file(data_path, 'file0', '0', '') self.assertIn(output_messages['INFO_ADDING_PATH'] % DATASETS, check_output(MLGIT_ADD % (DATASETS, DATASET_NAME, '--bumpversion'))) self.assertRegex(check_output(MLGIT_STATUS_SHORT % (DATASETS, DATASET_NAME)), DATASET_NO_COMMITS_INFO_REGEX + r'Changes to be committed:\s+' r'New file: data(\\|/)file0\s+' r'New file: datasets-ex.spec')
def test_01_status_after_put_on_new_file_in_dataset(self): self.set_up_status(DATASETS) data_path = os.path.join(self.tmp_dir, DATASETS, DATASET_NAME, 'data') os.makedirs(data_path, exist_ok=True) create_file(data_path, 'file', '0', '') self.assertRegex(check_output(MLGIT_STATUS_SHORT % (DATASETS, DATASET_NAME)), DATASET_NO_COMMITS_INFO_REGEX + r'Untracked files:\s+' + DATASET_ADD_INFO_REGEX + r'data(\\|/)file\s+' r'datasets-ex.spec')
def test_06_commit_entity_with_changed_dir(self): self._commit_entity(DATASETS) create_file(os.path.join(DATASETS, DATASET_NAME), 'newfile5', '0', '') move_entity_to_dir(self.tmp_dir, DATASET_NAME, DATASETS) self.assertNotIn( ERROR_MESSAGE, check_output(MLGIT_ADD % (DATASETS, DATASET_NAME, ' --bumpversion'))) self.assertNotIn( ERROR_MESSAGE, check_output(MLGIT_COMMIT % (DATASETS, DATASET_NAME, '')))
def test_05_status_after_put_on_new_file_in_dataset_with_directory_and_add_command(self): self.set_up_status('dataset') data_path = os.path.join(self.tmp_dir, 'dataset', 'dataset-ex', 'data') os.makedirs(data_path, exist_ok=True) create_file(data_path, 'file7', '0', '') check_output(MLGIT_ADD % ('dataset', 'dataset-ex', '--bumpversion')) self.assertRegex(check_output(MLGIT_STATUS_DIRECTORY % ('dataset', 'dataset-ex', 'data')), r'Changes to be committed:(\s|.)*New file: data(/|\\)file7(\s|.)*' r'Untracked files:\n\nCorrupted files:')
def test_03_hard_with_HEAD(self): self.set_up_reset() create_file(os.path.join(DATASETS, DATASET_NAME), 'file3', '0', '') check_output(MLGIT_ADD % (DATASETS, DATASET_NAME, '--bumpversion')) self.assertIn(output_messages['INFO_INITIALIZING_RESET'] % ('--hard', 'HEAD'), check_output(MLGIT_RESET % (DATASETS, DATASET_NAME) + ' --hard --reference=head')) self.assertRegex(check_output(MLGIT_STATUS % (DATASETS, DATASET_NAME)), DATASET_UNPUBLISHED_COMMITS_INFO_REGEX.format(unpublished_commits=2, pluralize_char='s') + DATASET_PUSH_INFO_REGEX + r'Changes to be committed:\s+' r'New file: datasets-ex.spec') self._check_dir('computer-vision__images__datasets-ex__2')