Ejemplo n.º 1
0
 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, '')))
Ejemplo n.º 2
0
 def test_08_checkout_entity_with_dir(self):
     init_repository(DATASETS, self)
     entity_dir, workspace, workspace_with_dir = move_entity_to_dir(
         self.tmp_dir, DATASET_NAME, DATASETS)
     add_file(self, DATASETS, '--bumpversion', 'new', entity_dir=entity_dir)
     self.assertNotIn(
         ERROR_MESSAGE,
         check_output(MLGIT_COMMIT % (DATASETS, DATASET_NAME, '')))
     self.assertNotIn(ERROR_MESSAGE,
                      check_output(MLGIT_PUSH % (DATASETS, DATASET_NAME)))
     self._clear_workspace(DATASETS)
     self.assertNotIn(
         ERROR_MESSAGE,
         check_output(MLGIT_CHECKOUT % (DATASETS, DATASET_NAME)))
     self.check_metadata(entity_dir)
Ejemplo n.º 3
0
 def test_06_hard_entity_with_changed_dir(self):
     entity_type = DATASETS
     artifact_name = DATASET_NAME
     init_repository(entity_type, self)
     create_file(os.path.join(entity_type, artifact_name), 'file1', '0', '')
     self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_ADD % (entity_type, artifact_name, '--bumpversion')))
     self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_COMMIT % (entity_type, artifact_name, '')))
     create_file(os.path.join(entity_type, artifact_name), 'file2', '0', '')
     entity_dir, workspace, workspace_with_dir = move_entity_to_dir(self.tmp_dir, artifact_name, entity_type)
     self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_ADD % (entity_type, artifact_name, '--bumpversion')))
     self.assertNotIn(ERROR_MESSAGE, check_output(MLGIT_COMMIT % (entity_type, artifact_name, '')))
     new_file_path = os.path.join(workspace_with_dir, artifact_name, 'file2')
     self.assertFalse(os.path.exists(workspace))
     self.assertTrue(os.path.exists(new_file_path))
     self.assertIn(output_messages['INFO_INITIALIZING_RESET'] % ('--hard', 'HEAD~1'),
                   check_output(MLGIT_RESET % (entity_type, artifact_name) + ' --hard --reference=head~1'))
     self.assertFalse(os.path.exists(new_file_path))
     self.assertTrue(os.path.exists(workspace))
Ejemplo n.º 4
0
    def test_09_checkout_entity_with_changed_dir(self):
        entity_type = DATASETS
        artifact_name = DATASET_NAME
        init_repository(entity_type, self)
        create_file(os.path.join(entity_type, artifact_name), 'file1', '0', '')
        self.assertNotIn(
            ERROR_MESSAGE,
            check_output(MLGIT_ADD % (entity_type, artifact_name, '')))
        self.assertNotIn(
            ERROR_MESSAGE,
            check_output(MLGIT_COMMIT % (entity_type, artifact_name, '')))
        self.assertNotIn(
            ERROR_MESSAGE,
            check_output(MLGIT_PUSH % (entity_type, artifact_name)))
        entity_dir, workspace, workspace_with_dir = move_entity_to_dir(
            self.tmp_dir, artifact_name, entity_type)
        add_file(self,
                 entity_type,
                 '--bumpversion',
                 'new',
                 entity_dir=entity_dir)
        self.assertNotIn(
            ERROR_MESSAGE,
            check_output(MLGIT_COMMIT % (entity_type, artifact_name, '')))
        self.assertNotIn(
            ERROR_MESSAGE,
            check_output(MLGIT_PUSH % (entity_type, artifact_name)))

        self.assertTrue(os.path.exists(workspace_with_dir))
        self.assertFalse(os.path.exists(workspace))
        self.assertNotIn(
            ERROR_MESSAGE,
            check_output(MLGIT_CHECKOUT %
                         (entity_type, artifact_name + '  --version=1')))
        self.check_metadata()
        self.assertFalse(os.path.exists(workspace_with_dir))
        self.assertTrue(os.path.exists(workspace))
        self.assertNotIn(
            ERROR_MESSAGE,
            check_output(MLGIT_CHECKOUT %
                         (entity_type, artifact_name + '  --version=2')))
        self.check_metadata(entity_dir)
        self.assertTrue(os.path.exists(workspace_with_dir))
        self.assertFalse(os.path.exists(workspace))