コード例 #1
0
ファイル: test_factory.py プロジェクト: grelleum/steelscript
def test_check_first_fail(check_foobar):
    with pytest.raises(factory.NoMatchingCallable):
        factory.get_by_standard_layout(BASE_PKG, 'model',
                                       search_list=SEARCH_LIST,
                                       search_start_value='four',
                                       service=SERVICE,
                                       check=check_foobar,
                                       first_fail=True)
コード例 #2
0
ファイル: test_factory.py プロジェクト: grelleum/steelscript
def test_feature_import_error():
    # The newest model in this path tries to import something that doesn't
    # exist, in order to genrerate an ImportError distinct from
    # a FactoryLookupError.
    with pytest.raises(ImportError):
        factory.get_by_standard_layout(BASE_PKG, 'model',
                                       search_list=SEARCH_LIST,
                                       feature=FEATURE)
コード例 #3
0
ファイル: test_factory.py プロジェクト: mezgerj/steelscript
def test_check_first_fail(check_foobar):
    with pytest.raises(factory.NoMatchingCallable):
        factory.get_by_standard_layout(BASE_PKG,
                                       'model',
                                       search_list=SEARCH_LIST,
                                       search_start_value='four',
                                       service=SERVICE,
                                       check=check_foobar,
                                       first_fail=True)
コード例 #4
0
ファイル: test_factory.py プロジェクト: mezgerj/steelscript
def test_feature_import_error():
    # The newest model in this path tries to import something that doesn't
    # exist, in order to genrerate an ImportError distinct from
    # a FactoryLookupError.
    with pytest.raises(ImportError):
        factory.get_by_standard_layout(BASE_PKG,
                                       'model',
                                       search_list=SEARCH_LIST,
                                       feature=FEATURE)
コード例 #5
0
ファイル: test_factory.py プロジェクト: grelleum/steelscript
def test_other_error():
    # Testing an import error from within the imported file is covered above.
    # We should also allow other sorts of errors to escape unchanged.
    # TODO: Is this correct or should we convert them to FactoryLookupError?

    with pytest.raises(SyntaxError):
        factory.get_by_standard_layout(BASE_PKG, 'action',
                                       search_list=SEARCH_LIST,
                                       service=SERVICE)
コード例 #6
0
ファイル: test_factory.py プロジェクト: mezgerj/steelscript
def test_other_error():
    # Testing an import error from within the imported file is covered above.
    # We should also allow other sorts of errors to escape unchanged.
    # TODO: Is this correct or should we convert them to FactoryLookupError?

    with pytest.raises(SyntaxError):
        factory.get_by_standard_layout(BASE_PKG,
                                       'action',
                                       search_list=SEARCH_LIST,
                                       service=SERVICE)
コード例 #7
0
ファイル: test_factory.py プロジェクト: grelleum/steelscript
def test_feature_start_after_error_before_expected():
    m = factory.get_by_standard_layout(BASE_PKG, 'model',
                                       search_list=SEARCH_LIST,
                                       search_start_value='two',
                                       feature=FEATURE)
    assert (os.path.join(BASE_PKG, 'features', FEATURE, 'one', 'model.py') in
            m.__file__)
コード例 #8
0
ファイル: test_factory.py プロジェクト: mezgerj/steelscript
def test_feature_start_after_error_before_expected():
    m = factory.get_by_standard_layout(BASE_PKG,
                                       'model',
                                       search_list=SEARCH_LIST,
                                       search_start_value='two',
                                       feature=FEATURE)
    assert (os.path.join(BASE_PKG, 'features', FEATURE, 'one', 'model.py')
            in m.__file__)
コード例 #9
0
ファイル: test_factory.py プロジェクト: grelleum/steelscript
def test_service_start_on_expected():
    # This test also ensures that we don't do an off-by-one indexing error
    # and skip the starting point.
    m = factory.get_by_standard_layout(BASE_PKG, 'model',
                                       search_list=SEARCH_LIST,
                                       search_start_value='two',
                                       service=SERVICE)
    assert (os.path.join(BASE_PKG, 'services', SERVICE, 'two', 'model.py') in
            m.__file__)
コード例 #10
0
ファイル: test_factory.py プロジェクト: mezgerj/steelscript
def test_service_start_on_expected():
    # This test also ensures that we don't do an off-by-one indexing error
    # and skip the starting point.
    m = factory.get_by_standard_layout(BASE_PKG,
                                       'model',
                                       search_list=SEARCH_LIST,
                                       search_start_value='two',
                                       service=SERVICE)
    assert (os.path.join(BASE_PKG, 'services', SERVICE, 'two', 'model.py')
            in m.__file__)
コード例 #11
0
ファイル: test_factory.py プロジェクト: grelleum/steelscript
def test_check(check_foobar):
    # Test to make sure we skip modules when a check is supplied.
    # In the ss_fake dir, four/model.py has no class, two/model.py has one.

    m = factory.get_by_standard_layout(BASE_PKG, 'model',
                                       search_list=SEARCH_LIST,
                                       search_start_value='four',
                                       service=SERVICE,
                                       check=check_foobar)
    assert m.__name__ == 'FooBar'
    assert m.__module__ == '.'.join((BASE_PKG, 'services', SERVICE,
                                     'two', 'model'))
コード例 #12
0
ファイル: test_factory.py プロジェクト: mezgerj/steelscript
def test_check(check_foobar):
    # Test to make sure we skip modules when a check is supplied.
    # In the ss_fake dir, four/model.py has no class, two/model.py has one.

    m = factory.get_by_standard_layout(BASE_PKG,
                                       'model',
                                       search_list=SEARCH_LIST,
                                       search_start_value='four',
                                       service=SERVICE,
                                       check=check_foobar)
    assert m.__name__ == 'FooBar'
    assert m.__module__ == '.'.join(
        (BASE_PKG, 'services', SERVICE, 'two', 'model'))
コード例 #13
0
ファイル: test_factory.py プロジェクト: grelleum/steelscript
def test_monolithic_not_found():
    with pytest.raises(factory.NoModuleFound):
        factory.get_by_standard_layout(BASE_PKG, 'weird',
                                       search_list=SEARCH_LIST,
                                       search_start_value='one')
コード例 #14
0
ファイル: test_factory.py プロジェクト: grelleum/steelscript
def test_monolithic():
    m = factory.get_by_standard_layout(BASE_PKG, 'weird',
                                       search_list=SEARCH_LIST)
    assert os.path.join(BASE_PKG, 'two', 'weird.py') in m.__file__
コード例 #15
0
ファイル: test_factory.py プロジェクト: grelleum/steelscript
def test_unversioned_fail():
    with pytest.raises(factory.NoModuleFound):
        factory.get_by_standard_layout(BASE_PKG, 'doesnotexist')
コード例 #16
0
ファイル: test_factory.py プロジェクト: grelleum/steelscript
def test_unversioned():
    # This form is used when a higher layer of factory calculates
    # the base package.
    m = factory.get_by_standard_layout(BASE_PKG, 'unversioned')
    assert 'unversioned' in unicode(m)
コード例 #17
0
ファイル: test_factory.py プロジェクト: mezgerj/steelscript
def test_unversioned():
    # This form is used when a higher layer of factory calculates
    # the base package.
    m = factory.get_by_standard_layout(BASE_PKG, 'unversioned')
    assert 'unversioned' in unicode(m)
コード例 #18
0
ファイル: test_factory.py プロジェクト: grelleum/steelscript
def test_not_found():
    with pytest.raises(factory.NoModuleFound):
        factory.get_by_standard_layout(BASE_PKG, 'action',
                                       search_list=SEARCH_LIST,
                                       feature=FEATURE)
コード例 #19
0
ファイル: test_factory.py プロジェクト: mezgerj/steelscript
def test_not_found():
    with pytest.raises(factory.NoModuleFound):
        factory.get_by_standard_layout(BASE_PKG,
                                       'action',
                                       search_list=SEARCH_LIST,
                                       feature=FEATURE)
コード例 #20
0
ファイル: test_factory.py プロジェクト: mezgerj/steelscript
def test_unversioned_fail():
    with pytest.raises(factory.NoModuleFound):
        factory.get_by_standard_layout(BASE_PKG, 'doesnotexist')
コード例 #21
0
ファイル: test_factory.py プロジェクト: mezgerj/steelscript
def test_monolithic_not_found():
    with pytest.raises(factory.NoModuleFound):
        factory.get_by_standard_layout(BASE_PKG,
                                       'weird',
                                       search_list=SEARCH_LIST,
                                       search_start_value='one')
コード例 #22
0
ファイル: test_factory.py プロジェクト: mezgerj/steelscript
def test_monolithic():
    m = factory.get_by_standard_layout(BASE_PKG,
                                       'weird',
                                       search_list=SEARCH_LIST)
    assert os.path.join(BASE_PKG, 'two', 'weird.py') in m.__file__