コード例 #1
0
def test_no_option_warning(jail, keyword_db):
    """If no operations is given, raise an error"""
    editor = se.Schema_editor(
        input=keyword_db
    )
    with pytest.raises(RuntimeError):
        editor.change()
コード例 #2
0
def run_editor_full(jail, keyword_db):
    """Just run the editor"""

    editor = se.Schema_editor(
        input=str(keyword_db), output=FIXED_SCHEMA,
        add=True, delete=True, edit=True, rename=True
    )
    editor.change()

    # The fixed schema live in a date-stamped folder under FIXED_SCHEMA.
    # It will be the only folder, so we can just return the first from the list.
    return os.path.join(FIXED_SCHEMA, os.listdir(FIXED_SCHEMA)[0])
コード例 #3
0
def test_limit_datamodels_from_file(jail, model_db, keyword_db, rtdata_module):
    """Test limiting datamodels from Schema_editor"""

    # Create the exclusion file.
    exclude = list(model_db)[1:]
    exclude_path = 'exclude.yaml'
    with open(exclude_path, 'w') as fh:
        yaml.dump(exclude, fh)

    # Run the editor
    editor = se.Schema_editor(input=str(keyword_db), exclude_file=exclude_path,
                              list=True, rename=True)
    editor.change()
    assert len(editor.model_db) == 1