Skip to content

Commit

Permalink
tests: add simple initial test for the -k arg
Browse files Browse the repository at this point in the history
As the argument is common to multiple commands, start by adding a test
for for-all-repos. The test currently only checks that the repository is
not cloned when it isn't already present. Future tests could confirm
other changes to the configuration are not made.

Signed-off-by: Christopher Larson <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
kergoth authored and jan-kiszka committed Apr 25, 2024
1 parent ac40ebc commit d1ca026
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ def test_for_all_repos(monkeykas, tmpdir):
== 'e9ca55a239caa1a2098e1d48773a29ea53c6cab2'


def test_for_all_repos_keep_config_unchanged(monkeykas, tmpdir):
tdir = str(tmpdir / 'test_commands')
shutil.copytree('tests/test_commands', tdir)
monkeykas.chdir(tdir)

with pytest.raises(FileNotFoundError, match=r'.*/kas_1.[01]'):
kas.kas(['for-all-repos', '--keep-config-unchanged', 'test.yml',
'pwd'])

assert not os.path.exists('kas_1.0')
assert not os.path.exists("kas_1.1")


def test_checkout(monkeykas, tmpdir):
tdir = str(tmpdir / 'test_commands')
shutil.copytree('tests/test_commands', tdir)
Expand Down

0 comments on commit d1ca026

Please sign in to comment.