MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / mapping_fixture

Method mapping_fixture

test/sql/test_lambdas.py:2169–2192  ·  view source on GitHub ↗
(self, decl_base)

Source from the content-addressed store, hash-verified

2167
2168 @testing.fixture
2169 def mapping_fixture(self, decl_base):
2170 class A(decl_base):
2171 __tablename__ = "a"
2172 id = Column(Integer, primary_key=True)
2173 col1 = Column(String(100))
2174 col2 = Column(String(100))
2175 col3 = Column(String(100))
2176 col4 = Column(String(100))
2177
2178 decl_base.metadata.create_all(testing.db)
2179
2180 from sqlalchemy.orm import Session
2181
2182 with testing.db.connect() as conn:
2183 with Session(conn) as session:
2184 session.add_all(
2185 [
2186 A(col1=str(i), col2=str(i), col3=str(i), col4=str(i))
2187 for i in range(self.THREADS + 1)
2188 ]
2189 )
2190 session.commit()
2191
2192 return A
2193
2194 @testing.requires.timing_intensive
2195 def test_lambda_concurrency(self, testing_engine, mapping_fixture):

Callers

nothing calls this directly

Calls 6

SessionClass · 0.90
create_allMethod · 0.80
AClass · 0.70
connectMethod · 0.45
add_allMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected