From: Jan Kiszka <
jan.k...@siemens.com>
Signed-off-by: Jan Kiszka <
jan.k...@siemens.com>
---
tests/test_refspec.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tests/test_refspec.py b/tests/test_refspec.py
index 0abf0ba..5c3df2e 100644
--- a/tests/test_refspec.py
+++ b/tests/test_refspec.py
@@ -182,6 +182,22 @@ def test_unsafe_tag_warning(capsys, monkeykas, tmpdir):
'are mutable.') == 1
+...@pytest.mark.online
+def test_unsafe_branch_warning(capsys, monkeykas, tmpdir):
+ """
+ Test that using branch without commit issues a warning, but only once.
+ """
+ tdir = str(tmpdir / 'test_unsafe_branch_warning')
+ shutil.copytree('tests/test_refspec', tdir)
+ monkeykas.chdir(tdir)
+ # needs to be reset in case other tests ran before
+ Repo.__no_commit_warned__ = []
+ kas.kas(['shell', 'test2.yml', '-c', 'true'])
+ assert capsys.readouterr().err.count(
+ 'Using branch without commit for repository "kas3" is unsafe. Either '
+ 'add a commit or use a lock file.') == 1
+
+
@pytest.mark.online
def test_tag_branch_same_name(capsys, monkeykas, tmpdir):
"""
--
2.47.3