diff options
| author | John Perkins <john.d.perkins@gmail.com> | 2016-08-05 13:45:49 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-09-20 12:11:11 -0400 |
| commit | e95aa257aa3145a5db478d33fb1803494a38b46d (patch) | |
| tree | 1e235379669c56444d21a3fa50b1e91d008686db /test | |
| parent | 881369b949cff44e0017fdc28d9722ef3c26171a (diff) | |
| download | sqlalchemy-e95aa257aa3145a5db478d33fb1803494a38b46d.tar.gz | |
Add the "triggering mapper" to the configure_mappers error message.
There are cases where the originating mapper name is not
present in the exception message, such as relationship initialization
against an unmapped class. Ensure the originating mapper is named
in the string output.
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/298
Change-Id: I9f23bfa90b26dde9229ab7ec812eec9ceae48153
Diffstat (limited to 'test')
| -rw-r--r-- | test/ext/declarative/test_basic.py | 7 | ||||
| -rw-r--r-- | test/orm/test_mapper.py | 10 |
2 files changed, 10 insertions, 7 deletions
diff --git a/test/ext/declarative/test_basic.py b/test/ext/declarative/test_basic.py index 67018d737..08bc04048 100644 --- a/test/ext/declarative/test_basic.py +++ b/test/ext/declarative/test_basic.py @@ -772,9 +772,10 @@ class DeclarativeTest(DeclarativeTestBase): for i in range(3): assert_raises_message( sa.exc.InvalidRequestError, - "^One or more mappers failed to initialize - " - "can't proceed with initialization of other " - "mappers. Original exception was: When initializing.*", + "^One or more mappers failed to initialize" + " - can't proceed with initialization of other mappers. " + r"Triggering mapper: 'Mapper\|User\|users'. " + "Original exception was: When initializing.*", configure_mappers) def test_custom_base(self): diff --git a/test/orm/test_mapper.py b/test/orm/test_mapper.py index bc5f24fb2..045016bb3 100644 --- a/test/orm/test_mapper.py +++ b/test/orm/test_mapper.py @@ -153,10 +153,12 @@ class MapperTest(_fixtures.FixtureTest, AssertsCompiledSQL): for i in range(3): assert_raises_message(sa.exc.InvalidRequestError, - "^One or more mappers failed to " - "initialize - can't proceed with " - "initialization of other mappers. " - "Original exception was: Class " + "^One or more " + "mappers failed to initialize - can't " + "proceed with initialization of other " + r"mappers. Triggering mapper\: " + r"'Mapper\|Address\|addresses'." + " Original exception was: Class " "'test.orm._fixtures.User' is not mapped$", configure_mappers) |
