[Notes] [Git][BuildStream/buildstream][jennis/deprecate_bst_checkout] 2 commits: completions.py: Add a test for our artifact ref autocompletions



Title: GitLab

James Ennis pushed to branch jennis/deprecate_bst_checkout at BuildStream / buildstream

Commits:

2 changed files:

Changes:

  • NEWS
    ... ... @@ -2,6 +2,19 @@
    2 2
     buildstream 1.3.1
    
    3 3
     =================
    
    4 4
     
    
    5
    +   o BREAKING CHANGE: Moved `checkout` to the artifact subcommands. `bst checkout` is
    
    6
    +     now obsolete.
    
    7
    +
    
    8
    +     The command is now `bst artifact checkout`. `bst checkout` has been deprecated.
    
    9
    +     This implements the features of `bst checkout`, although the mandatory LOCATION
    
    10
    +     argument should now be specified with the `--directory` option.
    
    11
    +
    
    12
    +     `artifact checkout` can handle both element names and artifact refs, of which it
    
    13
    +     can take multiple.
    
    14
    +
    
    15
    +     `--deps`, `--tar` and `--integrate` options are only supported when passed a
    
    16
    +     single ELEMENT target.
    
    17
    +
    
    5 18
       o Added `bst artifact log` subcommand for viewing build logs.
    
    6 19
     
    
    7 20
       o BREAKING CHANGE: The bst source-bundle command has been removed. The
    

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



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]