1
|
1
|
import os
|
2
|
2
|
import pytest
|
3
|
|
-from tests.testutils import cli
|
|
3
|
+from tests.testutils import cli, cli_integration
|
4
|
4
|
|
5
|
5
|
# Project directory
|
6
|
6
|
DATA_DIR = os.path.dirname(os.path.realpath(__file__))
|
... |
... |
@@ -285,15 +285,19 @@ def test_help_commands(cli, cmd, word_idx, expected): |
285
|
285
|
|
286
|
286
|
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'project'))
|
287
|
287
|
@pytest.mark.integration
|
288
|
|
-def test_argument_artifact(cli, tmpdir, datafiles):
|
|
288
|
+def test_argument_artifact(cli_integration, tmpdir, datafiles):
|
289
|
289
|
project = os.path.join(datafiles.dirname, datafiles.basename)
|
290
|
290
|
|
291
|
291
|
# Build an import element with no dependencies (as there will only be ONE cache key)
|
292
|
|
- result = cli.run(project=project, args=['build', 'import-bin.bst']) # Has no dependencies
|
|
292
|
+ result = cli_integration.run(project=project, args=['build', 'import-bin.bst']) # Has no dependencies
|
293
|
293
|
result.assert_success()
|
294
|
294
|
|
|
295
|
+ cli_integration.configure({
|
|
296
|
+ 'artifactdir': os.path.join(str(tmpdir), 'artifacts')
|
|
297
|
+ })
|
|
298
|
+
|
295
|
299
|
# Get the key and the artifact ref ($project/$element_name/$key)
|
296
|
|
- key = cli.get_element_key(project, 'import-bin.bst')
|
|
300
|
+ key = cli_integration.get_element_key(project, 'import-bin.bst')
|
297
|
301
|
artifact = os.path.join('test', 'import-bin', key)
|
298
|
302
|
|
299
|
303
|
# Test autocompletion of the artifact
|
... |
... |
@@ -305,14 +309,15 @@ def test_argument_artifact(cli, tmpdir, datafiles): |
305
|
309
|
|
306
|
310
|
for i, cmd in enumerate(cmds):
|
307
|
311
|
word_idx = 3
|
308
|
|
- result = cli.run(project=project, cwd=project, env={
|
|
312
|
+ result = cli_integration.run(project=project, cwd=project, env={
|
309
|
313
|
'_BST_COMPLETION': 'complete',
|
310
|
314
|
'COMP_WORDS': cmd,
|
|
315
|
+ 'XDG_CACHE_HOME': os.path.join(str(tmpdir), 'artifacts'),
|
311
|
316
|
'COMP_CWORD': str(word_idx)
|
312
|
317
|
})
|
313
|
318
|
words = []
|
314
|
319
|
if result.output:
|
315
|
|
- words = result.output.splitlines() # This leaves an extra space on each e.g. ['foo.bst ']
|
|
320
|
+ words = result.output.splitlines() # This leaves an extra space on each e.g. 'foo.bst ']
|
316
|
321
|
words = [word.strip() for word in words]
|
317
|
322
|
|
318
|
323
|
if i == 0:
|