summaryrefslogtreecommitdiff
path: root/tests/sources/git.py
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2018-12-07 17:36:00 +0000
committerChandan Singh <csingh43@bloomberg.net>2018-12-14 19:34:20 +0000
commit629a6e52410f97edb386e59c48b7a7c28b3bf30a (patch)
tree43cb5c3c94db5a6bb014d5f61a49c0b571caf6f6 /tests/sources/git.py
parent13eb7ed2f356e1f42a8d379e313d55c5d3875d34 (diff)
downloadbuildstream-629a6e52410f97edb386e59c48b7a7c28b3bf30a.tar.gz
Introduce new "source" command group
Following the message thread https://mail.gnome.org/archives/buildstream-list/2018-November/msg00106.html, implement a new command group called `source`. Move existing `track`, `fetch`, and the recently added `source-checkout` commands under this group. For `track` and `fetch`, this is a BREAKING change, as the old commands have been marked as obsolete. Using them will result in an error message that refers people to use the new versions, like `bst source fetch` instead of old `bst fetch`. `source-checkout` will now become `source checkout` (the dash has turned into a space), and is not a breaking change as it was added in the current development cycle. Note that the functionality to hide commands from help output was added only recently in Click, so the minimum version of Click that we now require is 7.0. Summary of changes: * _frontend/cli.py: Add `source` command group, mark previous versions as obsolete and hide them from the help output. * _frontend/complete.py: Fix completion for hidden commands. * setup.py: Bump Click minimum version to 7.0. * tests: Update to cope with the new command names. Fixes #814.
Diffstat (limited to 'tests/sources/git.py')
-rw-r--r--tests/sources/git.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/sources/git.py b/tests/sources/git.py
index c9e806269..f9aa62ba4 100644
--- a/tests/sources/git.py
+++ b/tests/sources/git.py
@@ -58,7 +58,7 @@ def test_fetch_bad_ref(cli, tmpdir, datafiles):
# Assert that fetch raises an error here
result = cli.run(project=project, args=[
- 'fetch', 'target.bst'
+ 'source', 'fetch', 'target.bst'
])
result.assert_main_error(ErrorDomain.STREAM, None)
result.assert_task_error(ErrorDomain.SOURCE, None)
@@ -91,7 +91,7 @@ def test_submodule_fetch_checkout(cli, tmpdir, datafiles):
_yaml.dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
result.assert_success()
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_success()
@@ -130,7 +130,7 @@ def test_submodule_fetch_source_enable_explicit(cli, tmpdir, datafiles):
_yaml.dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
result.assert_success()
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_success()
@@ -169,7 +169,7 @@ def test_submodule_fetch_source_disable(cli, tmpdir, datafiles):
_yaml.dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
result.assert_success()
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_success()
@@ -208,7 +208,7 @@ def test_submodule_fetch_submodule_does_override(cli, tmpdir, datafiles):
_yaml.dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
result.assert_success()
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_success()
@@ -252,7 +252,7 @@ def test_submodule_fetch_submodule_individual_checkout(cli, tmpdir, datafiles):
_yaml.dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
result.assert_success()
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_success()
@@ -297,7 +297,7 @@ def test_submodule_fetch_submodule_individual_checkout_explicit(cli, tmpdir, dat
_yaml.dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
result.assert_success()
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_success()
@@ -337,7 +337,7 @@ def test_submodule_fetch_project_override(cli, tmpdir, datafiles):
_yaml.dump(element, os.path.join(project, 'target.bst'))
# Fetch, build, checkout
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
result.assert_success()
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_success()
@@ -375,11 +375,11 @@ def test_submodule_track_ignore_inconsistent(cli, tmpdir, datafiles):
repo.add_file(os.path.join(project, 'inconsistent-submodule', '.gitmodules'))
# Fetch should work, we're not yet at the offending ref
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
result.assert_success()
# Track will encounter an inconsistent submodule without any ref
- result = cli.run(project=project, args=['track', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'track', 'target.bst'])
result.assert_success()
# Assert that we are just fine without it, and emit a warning to the user.
@@ -508,7 +508,7 @@ def test_unlisted_submodule(cli, tmpdir, datafiles, fail):
# We will notice this directly in fetch, as it will try to fetch
# the submodules it discovers as a result of fetching the primary repo.
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
# Assert a warning or an error depending on what we're checking
if fail == 'error':
@@ -571,19 +571,19 @@ def test_track_unlisted_submodule(cli, tmpdir, datafiles, fail):
# Fetch the repo, we will not see the warning because we
# are still pointing to a ref which predates the submodules
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
result.assert_success()
assert "git:unlisted-submodule" not in result.stderr
# We won't get a warning/error when tracking either, the source
# has not become Consistency.CACHED so the opportunity to check
# for the warning has not yet arisen.
- result = cli.run(project=project, args=['track', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'track', 'target.bst'])
result.assert_success()
assert "git:unlisted-submodule" not in result.stderr
# Fetching the repo at the new ref will finally reveal the warning
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
if fail == 'error':
result.assert_main_error(ErrorDomain.STREAM, None)
result.assert_task_error(ErrorDomain.PLUGIN, 'git:unlisted-submodule')
@@ -642,7 +642,7 @@ def test_invalid_submodule(cli, tmpdir, datafiles, fail):
# We will notice this directly in fetch, as it will try to fetch
# the submodules it discovers as a result of fetching the primary repo.
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
# Assert a warning or an error depending on what we're checking
if fail == 'error':
@@ -706,7 +706,7 @@ def test_track_invalid_submodule(cli, tmpdir, datafiles, fail):
# Fetch the repo, we will not see the warning because we
# are still pointing to a ref which predates the submodules
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
result.assert_success()
assert "git:invalid-submodule" not in result.stderr
@@ -715,7 +715,7 @@ def test_track_invalid_submodule(cli, tmpdir, datafiles, fail):
# not locally cached, the Source will be CACHED directly after
# tracking and the validations will occur as a result.
#
- result = cli.run(project=project, args=['track', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'track', 'target.bst'])
if fail == 'error':
result.assert_main_error(ErrorDomain.STREAM, None)
result.assert_task_error(ErrorDomain.PLUGIN, 'git:invalid-submodule')
@@ -751,7 +751,7 @@ def test_track_fetch(cli, tmpdir, datafiles, ref_format, tag, extra_commit):
_yaml.dump(element, element_path)
# Track it
- result = cli.run(project=project, args=['track', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'track', 'target.bst'])
result.assert_success()
element = _yaml.load(element_path)
@@ -767,7 +767,7 @@ def test_track_fetch(cli, tmpdir, datafiles, ref_format, tag, extra_commit):
assert len(new_ref) == 40
# Fetch it
- result = cli.run(project=project, args=['fetch', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
result.assert_success()
@@ -835,10 +835,10 @@ def test_git_describe(cli, tmpdir, datafiles, ref_storage, tag_type):
_yaml.dump(element, element_path)
if ref_storage == 'inline':
- result = cli.run(project=project, args=['track', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'track', 'target.bst'])
result.assert_success()
else:
- result = cli.run(project=project, args=['track', 'target.bst', '--deps', 'all'])
+ result = cli.run(project=project, args=['source', 'track', 'target.bst', '--deps', 'all'])
result.assert_success()
if ref_storage == 'inline':
@@ -916,7 +916,7 @@ def test_default_do_not_track_tags(cli, tmpdir, datafiles):
element_path = os.path.join(project, 'target.bst')
_yaml.dump(element, element_path)
- result = cli.run(project=project, args=['track', 'target.bst'])
+ result = cli.run(project=project, args=['source', 'track', 'target.bst'])
result.assert_success()
element = _yaml.load(element_path)