tests: Return to kas directory when test_patch finishes

This prevents subseqent tests from starting in the wrong directory.

Signed-off-by: Paul Barker <pbarker@konsulko.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Paul Barker 2020-06-15 19:10:13 +02:00 committed by Jan Kiszka
parent b998dfa722
commit 79bfe5a04d

View File

@ -32,8 +32,10 @@ def test_patch(tmpdir):
tdir = str(tmpdir.mkdir('test_patch'))
shutil.rmtree(tdir, ignore_errors=True)
shutil.copytree('tests/test_patch', tdir)
prev_dir = os.path.realpath(os.getcwd())
os.chdir(tdir)
kas.kas(['shell', 'test.yml', '-c', 'true'])
for f in ['kas/tests/test_patch/hello.sh', 'hello/hello.sh']:
assert os.stat(f)[stat.ST_MODE] & stat.S_IXUSR
kas.kas(['shell', 'test.yml', '-c', 'true'])
os.chdir(prev_dir)