[Notes] [Git][BuildStream/buildstream][juerg/git-describe] tests/sources/git.py: Add track and fetch test with and without tag



Title: GitLab

Jürg Billeter pushed to branch juerg/git-describe at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • tests/sources/git.py
    ... ... @@ -476,3 +476,35 @@ def test_ref_not_in_track_warn_error(cli, tmpdir, datafiles):
    476 476
         result = cli.run(project=project, args=['build', 'target.bst'])
    
    477 477
         result.assert_main_error(ErrorDomain.STREAM, None)
    
    478 478
         result.assert_task_error(ErrorDomain.PLUGIN, CoreWarnings.REF_NOT_IN_TRACK)
    
    479
    +
    
    480
    +
    
    481
    +@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
    
    482
    +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
    
    483
    +@pytest.mark.parametrize("tag,extra_commit", [(False, False), (True, False), (True, True)])
    
    484
    +def test_track_fetch(cli, tmpdir, datafiles, tag, extra_commit):
    
    485
    +    project = os.path.join(datafiles.dirname, datafiles.basename)
    
    486
    +
    
    487
    +    # Create the repo from 'repofiles' subdir
    
    488
    +    repo = create_repo('git', str(tmpdir))
    
    489
    +    ref = repo.create(os.path.join(project, 'repofiles'))
    
    490
    +    if tag:
    
    491
    +        repo.add_tag('tag')
    
    492
    +    if extra_commit:
    
    493
    +        repo.add_commit()
    
    494
    +
    
    495
    +    # Write out our test target
    
    496
    +    element = {
    
    497
    +        'kind': 'import',
    
    498
    +        'sources': [
    
    499
    +            repo.source_config()
    
    500
    +        ]
    
    501
    +    }
    
    502
    +    _yaml.dump(element, os.path.join(project, 'target.bst'))
    
    503
    +
    
    504
    +    # Track it
    
    505
    +    result = cli.run(project=project, args=['track', 'target.bst'])
    
    506
    +    result.assert_success()
    
    507
    +
    
    508
    +    # Fetch it
    
    509
    +    result = cli.run(project=project, args=['fetch', 'target.bst'])
    
    510
    +    result.assert_success()



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