(self)
| 113 | ) |
| 114 | |
| 115 | def test_call_with_kwargs(self): |
| 116 | mock_scope_func = Mock() |
| 117 | SessionMaker = sa.orm.sessionmaker() |
| 118 | Session = scoped_session(sa.orm.sessionmaker(), mock_scope_func) |
| 119 | |
| 120 | s0 = SessionMaker() |
| 121 | assert s0.autoflush == True |
| 122 | |
| 123 | mock_scope_func.return_value = 0 |
| 124 | s1 = Session() |
| 125 | assert s1.autoflush == True |
| 126 | |
| 127 | assert_raises_message( |
| 128 | sa.exc.InvalidRequestError, |
| 129 | "Scoped session is already present", |
| 130 | Session, |
| 131 | autoflush=False, |
| 132 | ) |
| 133 | |
| 134 | mock_scope_func.return_value = 1 |
| 135 | s2 = Session(autoflush=False) |
| 136 | assert s2.autoflush == False |
| 137 | |
| 138 | def test_methods_etc(self): |
| 139 | mock_session = Mock() |
nothing calls this directly
no test coverage detected