| ... |
... |
@@ -289,3 +289,45 @@ def test_argument_element_invalid(datafiles, cli, project, cmd, word_idx, expect |
|
289
|
289
|
])
|
|
290
|
290
|
def test_help_commands(cli, cmd, word_idx, expected):
|
|
291
|
291
|
assert_completion(cli, cmd, word_idx, expected)
|
|
|
292
|
+
|
|
|
293
|
+
|
|
|
294
|
+@pytest.mark.datafiles(DATA_DIR)
|
|
|
295
|
+@pytest.mark.integration
|
|
|
296
|
+def test_argument_artifact(datafiles, cli):
|
|
|
297
|
+ project = os.path.join(datafiles.dirname, datafiles.basename, 'project')
|
|
|
298
|
+ cwd = os.path.join(project)
|
|
|
299
|
+
|
|
|
300
|
+ # Build an import element with no dependencies (as there will only be ONE cache key)
|
|
|
301
|
+ result = cli.run(project=project, args=['build', 'import-bin.bst']) # Has no dependencies
|
|
|
302
|
+ result.assert_success()
|
|
|
303
|
+
|
|
|
304
|
+ # Get the key and the artifact ref ($project/$element_name/$key)
|
|
|
305
|
+ key = cli.get_element_key(project, 'import-bin.bst')
|
|
|
306
|
+ artifact = os.path.join('test', 'import-bin', key)
|
|
|
307
|
+
|
|
|
308
|
+ # Test autocompletion of the artifact
|
|
|
309
|
+ cmds = [
|
|
|
310
|
+ 'bst artifact log ',
|
|
|
311
|
+ 'bst artifact log t',
|
|
|
312
|
+ 'bst artifact log test/'
|
|
|
313
|
+ ]
|
|
|
314
|
+
|
|
|
315
|
+ for i, cmd in enumerate(cmds):
|
|
|
316
|
+ word_idx = 3
|
|
|
317
|
+ result = cli.run(project=project, cwd=cwd, env={
|
|
|
318
|
+ '_BST_COMPLETION': 'complete',
|
|
|
319
|
+ 'COMP_WORDS': cmd,
|
|
|
320
|
+ 'COMP_CWORD': str(word_idx)
|
|
|
321
|
+ })
|
|
|
322
|
+ words = []
|
|
|
323
|
+ if result.output:
|
|
|
324
|
+ words = result.output.splitlines()
|
|
|
325
|
+
|
|
|
326
|
+ if i == 0:
|
|
|
327
|
+ expected = PROJECT_ELEMENTS + [artifact] # We should now be able to see the artifact
|
|
|
328
|
+ elif i == 1:
|
|
|
329
|
+ expected = ['target.bst', artifact]
|
|
|
330
|
+ elif i == 2:
|
|
|
331
|
+ expected = [artifact]
|
|
|
332
|
+
|
|
|
333
|
+ assert artifact in words
|