def test_generate_tuto_from_wf(): """Test :func:`planemo.training.generate_tuto_from_wf`.""" train = Training(KWDS) train.kwds['tutorial_name'] = None train.kwds['slides'] = False train.init_training(CTX) train.kwds['tutorial_name'] = 'existing_tutorial' create_existing_tutorial('existing_tutorial', tuto_fp, train.topic) # no workflow train.kwds['workflow'] = None exp_exception = "A path to a local workflow or the id of a workflow on a running Galaxy instance should be provided" with assert_raises_regexp(Exception, exp_exception): train.generate_tuto_from_wf(CTX) # with workflow train.kwds['workflow'] = WF_FP train.generate_tuto_from_wf(CTX) assert '**FastQC** {% icon tool %} with the following parameters:' in open(train.tuto.tuto_fp, 'r').read() assert os.path.exists(train.tuto.wf_fp) # clean after shutil.rmtree(train.topics_dir) shutil.rmtree("metadata")
def test_generate_tuto_from_wf(): """Test :func:`planemo.training.generate_tuto_from_wf`.""" train = Training(KWDS) train.kwds['tutorial_name'] = None train.kwds['slides'] = False train.init_training(CTX) train.kwds['tutorial_name'] = 'existing_tutorial' create_existing_tutorial('existing_tutorial', tuto_fp, train.topic) # no workflow train.kwds['workflow'] = None exp_exception = "A path to a local workflow or the id of a workflow on a running Galaxy instance should be provided" with assert_raises_regexp(Exception, exp_exception): train.generate_tuto_from_wf(CTX) # with workflow train.kwds['workflow'] = WF_FP train.generate_tuto_from_wf(CTX) assert_file_contains( train.tuto.tuto_fp, "{% tool [FastQC](toolshed.g2.bx.psu.edu/repos/devteam/fastqc/fastqc/0.71) %} with the following parameters:", ) assert os.path.exists(train.tuto.wf_fp) # clean after shutil.rmtree(train.topics_dir) shutil.rmtree("metadata")
def cli(ctx, uris, **kwds): """Create tutorial skeleton from workflow.""" kwds["no_dependency_resolution"] = True training = Training(kwds) training.generate_tuto_from_wf(ctx)