Пример #1
0
def create_context():
    cl = Checklist.read(
        Path(__file__).absolute().parents[1] / "deon" / "assets" /
        "checklist.yml")
    checklist_template = Markdown(cl)
    rendered_checklist = checklist_template.render()

    runner = CliRunner()
    result = runner.invoke(deon_command, ["--help"])

    table = make_table_of_links()

    return {
        "default_checklist": rendered_checklist,
        "cli_options": result.output,
        "supported_formats": EXTENSIONS,
        "links_table": table,
    }
Пример #2
0
def create_context():
    cl = Checklist.read(
        Path(__file__).absolute().parents[1] / 'deon' / 'assets' /
        'checklist.yml')
    checklist_template = Markdown(cl)
    rendered_checklist = checklist_template.render()

    runner = CliRunner()
    result = runner.invoke(deon_command, ['--help'])

    table = make_table_of_links()

    return {
        'default_checklist': rendered_checklist,
        'cli_options': result.output,
        'supported_formats': EXTENSIONS,
        'links_table': table,
    }
Пример #3
0
def test_markdown(checklist, tmpdir):
    known_good = assets.known_good_markdown
    existing_text = assets.existing_text

    m = Markdown(checklist)
    assert m.render() == known_good

    # no existing file
    temp_file_path = tmpdir.join('test.md')
    m.write(temp_file_path)
    assert temp_file_path.read() == known_good

    # Rmd also works
    temp_file_path = tmpdir.join('test.Rmd')
    m.write(temp_file_path)
    assert temp_file_path.read() == known_good

    # append to existing file
    with open(temp_file_path, 'w') as f:
        f.write(existing_text)
    m.write(temp_file_path, overwrite=False)
    assert temp_file_path.read() == existing_text + Markdown.append_delimiter + known_good

    # overwrite existing file
    m.write(temp_file_path, overwrite=True)
    assert temp_file_path.read() == known_good