@@ -34,12 +34,12 @@ def get_allocated_batch_ref(session, orderid, sku):
34
34
return batchref
35
35
36
36
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 ()
39
39
insert_batch (session , 'batch1' , 'HIPSTER-WORKBENCH' , 100 , None )
40
40
session .commit ()
41
41
42
- uow = unit_of_work .SqlAlchemyUnitOfWork (session_factory )
42
+ uow = unit_of_work .SqlAlchemyUnitOfWork (sqlite_session_factory )
43
43
with uow :
44
44
product = uow .products .get (sku = 'HIPSTER-WORKBENCH' )
45
45
line = model .OrderLine ('o1' , 'HIPSTER-WORKBENCH' , 10 )
@@ -50,27 +50,27 @@ def test_uow_can_retrieve_a_batch_and_allocate_to_it(session_factory):
50
50
assert batchref == 'batch1'
51
51
52
52
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 )
55
55
with uow :
56
56
insert_batch (uow .session , 'batch1' , 'MEDIUM-PLINTH' , 100 , None )
57
57
58
- new_session = session_factory ()
58
+ new_session = sqlite_session_factory ()
59
59
rows = list (new_session .execute ('SELECT * FROM "batches"' ))
60
60
assert rows == []
61
61
62
62
63
- def test_rolls_back_on_error (session_factory ):
63
+ def test_rolls_back_on_error (sqlite_session_factory ):
64
64
class MyException (Exception ):
65
65
pass
66
66
67
- uow = unit_of_work .SqlAlchemyUnitOfWork (session_factory )
67
+ uow = unit_of_work .SqlAlchemyUnitOfWork (sqlite_session_factory )
68
68
with pytest .raises (MyException ):
69
69
with uow :
70
70
insert_batch (uow .session , 'batch1' , 'LARGE-FORK' , 100 , None )
71
71
raise MyException ()
72
72
73
- new_session = session_factory ()
73
+ new_session = sqlite_session_factory ()
74
74
rows = list (new_session .execute ('SELECT * FROM "batches"' ))
75
75
assert rows == []
76
76
0 commit comments