Esempio n. 1
0
def test__load_entry_points_entry_points(iep_mock):
    # setup
    something_else_ep = EntryPoint('something_else', 'mlblocks.__version__')
    primitives_ep = EntryPoint('primitives',
                               'tests.test_discovery',
                               attrs=['FAKE_PRIMITIVES_PATH'],
                               dist=Distribution())
    another_primitives_ep = EntryPoint('primitives',
                                       'tests.test_discovery',
                                       attrs=['FAKE_PRIMITIVES_PATHS'],
                                       dist=Distribution())
    iep_mock.return_value = [
        something_else_ep, primitives_ep, another_primitives_ep
    ]

    # run
    paths = discovery._load_entry_points('primitives')

    # assert
    expected = [
        'this/is/a/fake',
        'this/is/another/fake',
        'this/is/yet/another/fake',
    ]
    assert paths == expected

    expected_calls = [
        call('mlblocks'),
    ]
    assert iep_mock.call_args_list == expected_calls
Esempio n. 2
0
def test__load_entry_points_no_entry_points(iep_mock):
    # setup
    iep_mock.return_value == []

    # run
    paths = discovery._load_entry_points('jsons_path', 'mlprimitives')

    # assert
    assert paths == []
    expected_calls = [
        call('mlprimitives'),
    ]
    assert iep_mock.call_args_list == expected_calls