def test_basics(path): ds = Dataset(path).create(force=True) # TODO: this procedure would leave a clean dataset, but `run` cannot handle dirty # input yet, so manual for now # V6FACT: this leaves the file staged, but not committed ds.add('code', to_git=True) # V6FACT: even this leaves it staged ds.add('.') # V6FACT: but this finally commits it ds.save() # TODO remove above two lines ds.run_procedure('setup_yoda_dataset') ok_clean_git(ds.path) # configure dataset to look for procedures in its code folder ds.config.add('datalad.locations.dataset-procedures', 'code', where='dataset') # configure dataset to run the demo procedure prior to the clean command ds.config.add('datalad.clean.proc-pre', 'datalad_test_proc', where='dataset') # run command that should trigger the demo procedure ds.clean() # look for traces ok_file_has_content(op.join(ds.path, 'fromproc.txt'), 'hello\n') ok_clean_git(ds.path, index_modified=[op.join('.datalad', 'config')])
def test_basics(path, super_path): ds = Dataset(path).create(force=True) ds.run_procedure('setup_yoda_dataset') ok_clean_git(ds.path) assert_false(ds.repo.is_under_annex("README.md")) # configure dataset to look for procedures in its code folder ds.config.add('datalad.locations.dataset-procedures', 'code', where='dataset') # commit this procedure config for later use in a clone: ds.add(op.join('.datalad', 'config')) # configure dataset to run the demo procedure prior to the clean command ds.config.add('datalad.clean.proc-pre', 'datalad_test_proc', where='dataset') # run command that should trigger the demo procedure ds.clean() # look for traces ok_file_has_content(op.join(ds.path, 'fromproc.txt'), 'hello\n') ok_clean_git(ds.path, index_modified=[op.join('.datalad', 'config')]) # make a fresh dataset: super = Dataset(super_path).create() # configure dataset to run the demo procedure prior to the clean command super.config.add('datalad.clean.proc-pre', 'datalad_test_proc', where='dataset') # 'super' doesn't know any procedures but should get to know one by # installing the above as a subdataset super.install('sub', source=ds.path) # run command that should trigger the demo procedure super.clean() # look for traces ok_file_has_content(op.join(super.path, 'fromproc.txt'), 'hello\n') ok_clean_git(super.path, index_modified=[op.join('.datalad', 'config')])
def test_basics(path, super_path): ds = Dataset(path).create(force=True) ds.run_procedure('setup_yoda_dataset') ok_clean_git(ds.path) assert_false(ds.repo.is_under_annex("README.md")) # configure dataset to look for procedures in its code folder ds.config.add( 'datalad.locations.dataset-procedures', 'code', where='dataset') # commit this procedure config for later use in a clone: ds.add(op.join('.datalad', 'config')) # configure dataset to run the demo procedure prior to the clean command ds.config.add( 'datalad.clean.proc-pre', 'datalad_test_proc', where='dataset') # run command that should trigger the demo procedure ds.clean() # look for traces ok_file_has_content(op.join(ds.path, 'fromproc.txt'), 'hello\n') ok_clean_git(ds.path, index_modified=[op.join('.datalad', 'config')]) # make a fresh dataset: super = Dataset(super_path).create() # configure dataset to run the demo procedure prior to the clean command super.config.add( 'datalad.clean.proc-pre', 'datalad_test_proc', where='dataset') # 'super' doesn't know any procedures but should get to know one by # installing the above as a subdataset super.install('sub', source=ds.path) # run command that should trigger the demo procedure super.clean() # look for traces ok_file_has_content(op.join(super.path, 'fromproc.txt'), 'hello\n') ok_clean_git(super.path, index_modified=[op.join('.datalad', 'config')])