How to use the ocrmypdf._plugins.load_plugin function in ocrmypdf

To help you get started, we’ve selected a few ocrmypdf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jbarlow83 / OCRmyPDF / tests / test_filters.py View on Github external
def test_module():
    obj = load_plugin(f'os.getuid')
    assert obj() == os.getuid()
github jbarlow83 / OCRmyPDF / tests / test_filters.py View on Github external
def test_pyfile_notexist():
    with pytest.raises(FileNotFoundError):
        load_plugin('thisfile.doesnot.exist.py::filter_42')
github jbarlow83 / OCRmyPDF / tests / test_filters.py View on Github external
def test_module_notexist():
    with pytest.raises(ModuleNotFoundError):
        load_plugin('thismodule.doesnot.exist')
github jbarlow83 / OCRmyPDF / tests / test_filters.py View on Github external
def test_pyfile():
    obj = load_plugin(f'{__file__}::filter_42')
    assert obj() == 42
github jbarlow83 / OCRmyPDF / tests / test_filters.py View on Github external
def test_pyfile_noobject():
    with pytest.raises(AttributeError):
        load_plugin(f'{__file__}::no_function_with_this_name')