From ee2600a51bd4290d1b3b197d2c52a4d194c9f43f Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Fri, 8 Oct 2021 17:54:47 +0200 Subject: [PATCH] tests: test_patch: Restore current directory on exit Avoids that succeeding tests may stumble over this. So far not an issue. Drop a forgotten debug print at this chance. Signed-off-by: Jan Kiszka --- tests/test_patch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_patch.py b/tests/test_patch.py index 36449b0..610d6cc 100644 --- a/tests/test_patch.py +++ b/tests/test_patch.py @@ -30,11 +30,13 @@ def test_patch(changedir, tmpdir): tdir = str(tmpdir.mkdir('test_patch')) shutil.rmtree(tdir, ignore_errors=True) shutil.copytree('tests/test_patch', tdir) + cwd = 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(cwd) def test_patch_update(changedir, tmpdir): @@ -45,10 +47,11 @@ def test_patch_update(changedir, tmpdir): """ tdir = str(tmpdir.mkdir('test_patch_update')) shutil.rmtree(tdir, ignore_errors=True) - print(os.getcwd()) shutil.copytree('tests/test_patch', tdir) + cwd = os.getcwd() os.chdir(tdir) kas.kas(['shell', 'test.yml', '-c', 'true']) kas.kas(['shell', 'test2.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 + os.chdir(cwd)