2424@pytest .fixture
2525def support (rootdir , tmp_path , request ):
2626 settings = {
27- 'srcdir' : rootdir / 'test-root' ,
27+ 'srcdir' : rootdir / 'test-root' / 'root' ,
2828 # to use same directory for 'builddir' in each 'support' fixture, using
2929 # 'tempdir' (static) value instead of 'tempdir' fixture value.
3030 # each test expect result of db value at previous test case.
@@ -61,6 +61,7 @@ def test_build(support):
6161@skip_if_sqlalchemy_missing
6262@with_support ()
6363def test_get_document (support ):
64+ support .build ()
6465 with pytest .raises (DocumentNotFoundError ):
6566 support .get_document ('nonexisting' )
6667
@@ -72,6 +73,7 @@ def test_get_document(support):
7273@skip_if_sqlalchemy_missing
7374@with_support ()
7475def test_comments (support ):
76+ support .build ()
7577 session = Session ()
7678 nodes = session .query (Node ).all ()
7779 first_node = nodes [0 ]
@@ -127,6 +129,7 @@ def get_comment():
127129 session .close ()
128130 return support .get_data (node .id )['comments' ][0 ]
129131
132+ test_comments (support )
130133 comment = get_comment ()
131134 assert comment ['username' ] == 'user_one'
132135 # Make sure other normal users can't delete someone elses comments.
@@ -150,6 +153,7 @@ def moderation_callback(comment):
150153@skip_if_sqlalchemy_missing
151154@with_support (moderation_callback = moderation_callback )
152155def test_moderation (support ):
156+ support .build ()
153157 session = Session ()
154158 nodes = session .query (Node ).all ()
155159 node = nodes [7 ]
@@ -182,6 +186,7 @@ def get_comment():
182186 session .close ()
183187 return support .get_data (node .id , moderator = True )['comments' ][1 ]
184188
189+ test_comments (support )
185190 comment = get_comment ()
186191 support .delete_comment (comment ['id' ], username = 'user_two' ,
187192 moderator = True )
@@ -192,6 +197,7 @@ def get_comment():
192197@skip_if_sqlalchemy_missing
193198@with_support ()
194199def test_update_username (support ):
200+ test_comments (support )
195201 support .update_username ('user_two' , 'new_user_two' )
196202 session = Session ()
197203 comments = session .query (Comment ).\
@@ -211,6 +217,7 @@ def test_update_username(support):
211217@skip_if_sqlalchemy_missing
212218@with_support ()
213219def test_proposals (support ):
220+ support .build ()
214221 session = Session ()
215222 node = session .query (Node ).first ()
216223
@@ -227,6 +234,7 @@ def test_proposals(support):
227234@skip_if_sqlalchemy_missing
228235@with_support ()
229236def test_voting (support ):
237+ test_comments (support )
230238 session = Session ()
231239 nodes = session .query (Node ).all ()
232240 node = nodes [0 ]
0 commit comments