@@ -34,12 +34,12 @@ def get_allocated_batch_ref(session, orderid, sku):
3434 return batchref
3535
3636
37- def test_uow_can_retrieve_a_batch_and_allocate_to_it (session_factory ):
38- session = session_factory ()
37+ def test_uow_can_retrieve_a_batch_and_allocate_to_it (sqlite_session_factory ):
38+ session = sqlite_session_factory ()
3939 insert_batch (session , "batch1" , "HIPSTER-WORKBENCH" , 100 , None )
4040 session .commit ()
4141
42- uow = unit_of_work .SqlAlchemyUnitOfWork (session_factory )
42+ uow = unit_of_work .SqlAlchemyUnitOfWork (sqlite_session_factory )
4343 with uow :
4444 product = uow .products .get (sku = "HIPSTER-WORKBENCH" )
4545 line = model .OrderLine ("o1" , "HIPSTER-WORKBENCH" , 10 )
@@ -50,27 +50,27 @@ def test_uow_can_retrieve_a_batch_and_allocate_to_it(session_factory):
5050 assert batchref == "batch1"
5151
5252
53- def test_rolls_back_uncommitted_work_by_default (session_factory ):
54- uow = unit_of_work .SqlAlchemyUnitOfWork (session_factory )
53+ def test_rolls_back_uncommitted_work_by_default (sqlite_session_factory ):
54+ uow = unit_of_work .SqlAlchemyUnitOfWork (sqlite_session_factory )
5555 with uow :
5656 insert_batch (uow .session , "batch1" , "MEDIUM-PLINTH" , 100 , None )
5757
58- new_session = session_factory ()
58+ new_session = sqlite_session_factory ()
5959 rows = list (new_session .execute ('SELECT * FROM "batches"' ))
6060 assert rows == []
6161
6262
63- def test_rolls_back_on_error (session_factory ):
63+ def test_rolls_back_on_error (sqlite_session_factory ):
6464 class MyException (Exception ):
6565 pass
6666
67- uow = unit_of_work .SqlAlchemyUnitOfWork (session_factory )
67+ uow = unit_of_work .SqlAlchemyUnitOfWork (sqlite_session_factory )
6868 with pytest .raises (MyException ):
6969 with uow :
7070 insert_batch (uow .session , "batch1" , "LARGE-FORK" , 100 , None )
7171 raise MyException ()
7272
73- new_session = session_factory ()
73+ new_session = sqlite_session_factory ()
7474 rows = list (new_session .execute ('SELECT * FROM "batches"' ))
7575 assert rows == []
7676
0 commit comments