[Notes] [Git][BuildStream/buildstream][bst-1.2] 3 commits: element.py: Raise an exception on unbuilt element checkout



Title: GitLab

Tristan Van Berkom pushed to branch bst-1.2 at BuildStream / buildstream

Commits:

3 changed files:

Changes:

  • buildstream/_stream.py
    ... ... @@ -437,7 +437,7 @@ class Stream():
    437 437
     
    
    438 438
             except BstError as e:
    
    439 439
                 raise StreamError("Error while staging dependencies into a sandbox"
    
    440
    -                              ": '{}'".format(e), reason=e.reason) from e
    
    440
    +                              ": '{}'".format(e), detail=e.detail, reason=e.reason) from e
    
    441 441
     
    
    442 442
         # workspace_open
    
    443 443
         #
    

  • buildstream/element.py
    ... ... @@ -613,6 +613,12 @@ class Element(Plugin):
    613 613
                   dep.stage_artifact(sandbox)
    
    614 614
             """
    
    615 615
     
    
    616
    +        if not self._cached():
    
    617
    +            detail = "No artifacts have been cached yet for that element\n" + \
    
    618
    +                     "Try building the element first with `bst build`\n"
    
    619
    +            raise ElementError("No artifacts to stage",
    
    620
    +                               detail=detail, reason="uncached-checkout-attempt")
    
    621
    +
    
    616 622
             if update_mtimes is None:
    
    617 623
                 update_mtimes = []
    
    618 624
     
    

  • tests/frontend/buildcheckout.py
    ... ... @@ -96,6 +96,16 @@ def test_build_checkout_deps(datafiles, cli, deps):
    96 96
             assert not os.path.exists(filename)
    
    97 97
     
    
    98 98
     
    
    99
    +@pytest.mark.datafiles(DATA_DIR)
    
    100
    +def test_build_checkout_unbuilt(datafiles, cli):
    
    101
    +    project = os.path.join(datafiles.dirname, datafiles.basename)
    
    102
    +    checkout = os.path.join(cli.directory, 'checkout')
    
    103
    +
    
    104
    +    # Check that checking out an unbuilt element fails nicely
    
    105
    +    result = cli.run(project=project, args=['checkout', 'target.bst', checkout])
    
    106
    +    result.assert_main_error(ErrorDomain.STREAM, "uncached-checkout-attempt")
    
    107
    +
    
    108
    +
    
    99 109
     @pytest.mark.datafiles(DATA_DIR)
    
    100 110
     def test_build_checkout_tarball(datafiles, cli):
    
    101 111
         project = os.path.join(datafiles.dirname, datafiles.basename)
    



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