33
33
34
34
import pytest
35
35
36
- from buildstream .testing import create_repo , ALL_REPO_KINDS
36
+ from buildstream .testing import create_repo
37
37
from buildstream .testing import cli # pylint: disable=unused-import
38
38
from buildstream import _yaml
39
39
from buildstream .exceptions import ErrorDomain , LoadErrorReason
40
40
from buildstream ._workspaces import BST_WORKSPACE_FORMAT_VERSION
41
41
42
42
from tests .testutils import create_artifact_share , create_element_size , wait_for_cache_granularity
43
43
44
- repo_kinds = ALL_REPO_KINDS
45
44
46
45
# Project directory
47
46
DATA_DIR = os .path .join (os .path .dirname (os .path .realpath (__file__ )), "project" ,)
@@ -170,10 +169,13 @@ def open_workspace(
170
169
@pytest .mark .datafiles (DATA_DIR )
171
170
def test_open_multi (cli , tmpdir , datafiles ):
172
171
workspace_object = WorkspaceCreator (cli , tmpdir , datafiles )
173
- workspaces = workspace_object .open_workspaces (repo_kinds )
172
+ kinds = ["tar" ] * 2
173
+ suffixs = range (2 )
174
174
175
- for (elname , workspace ), kind in zip (workspaces , repo_kinds ):
176
- assert kind in elname
175
+ workspaces = workspace_object .open_workspaces (kinds , suffixs )
176
+
177
+ for (elname , workspace ), kind , suffix in zip (workspaces , kinds , suffixs ):
178
+ assert "{}{}" .format (kind , suffix ) in elname
177
179
workspace_lsdir = os .listdir (workspace )
178
180
assert elname in workspace_lsdir
179
181
@@ -182,8 +184,10 @@ def test_open_multi(cli, tmpdir, datafiles):
182
184
@pytest .mark .datafiles (DATA_DIR )
183
185
def test_open_multi_unwritable (cli , tmpdir , datafiles ):
184
186
workspace_object = WorkspaceCreator (cli , tmpdir , datafiles )
187
+ kinds = ["tar" ] * 2
188
+ suffixs = range (2 )
185
189
186
- element_tuples = workspace_object .create_workspace_elements (repo_kinds , repo_kinds )
190
+ element_tuples = workspace_object .create_workspace_elements (kinds , suffixs )
187
191
os .makedirs (workspace_object .workspace_cmd , exist_ok = True )
188
192
189
193
# Now open the workspace, this should have the effect of automatically
@@ -209,8 +213,10 @@ def test_open_multi_unwritable(cli, tmpdir, datafiles):
209
213
@pytest .mark .datafiles (DATA_DIR )
210
214
def test_open_multi_with_directory (cli , tmpdir , datafiles ):
211
215
workspace_object = WorkspaceCreator (cli , tmpdir , datafiles )
216
+ kinds = ["tar" ] * 2
217
+ suffixs = range (2 )
212
218
213
- element_tuples = workspace_object .create_workspace_elements (repo_kinds , repo_kinds )
219
+ element_tuples = workspace_object .create_workspace_elements (kinds , suffixs )
214
220
os .makedirs (workspace_object .workspace_cmd , exist_ok = True )
215
221
216
222
# Now open the workspace, this should have the effect of automatically
@@ -636,16 +642,15 @@ def test_list(cli, tmpdir, datafiles):
636
642
637
643
638
644
@pytest .mark .datafiles (DATA_DIR )
639
- @pytest .mark .parametrize ("kind" , repo_kinds )
640
645
@pytest .mark .parametrize ("strict" , [("strict" ), ("non-strict" )])
641
646
@pytest .mark .parametrize (
642
647
"from_workspace,guess_element" ,
643
648
[(False , False ), (True , True ), (True , False )],
644
649
ids = ["project-no-guess" , "workspace-guess" , "workspace-no-guess" ],
645
650
)
646
- def test_build (cli , tmpdir_factory , datafiles , kind , strict , from_workspace , guess_element ):
651
+ def test_build (cli , tmpdir_factory , datafiles , strict , from_workspace , guess_element ):
647
652
tmpdir = tmpdir_factory .mktemp (BASE_FILENAME )
648
- element_name , project , workspace = open_workspace (cli , tmpdir , datafiles , kind , False )
653
+ element_name , project , workspace = open_workspace (cli , tmpdir , datafiles , "tar" , False )
649
654
checkout = os .path .join (str (tmpdir ), "checkout" )
650
655
args_dir = ["-C" , workspace ] if from_workspace else []
651
656
args_elm = [element_name ] if not guess_element else []
0 commit comments