From eb77c2466973b9e889d4f72883298bebd4cc1702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Czech?= Date: Wed, 6 Mar 2024 22:53:36 +0100 Subject: [PATCH] Update github-runner tests (#204) --- tests/test_oiejq.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/test_oiejq.py b/tests/test_oiejq.py index 7d2afa58..785d3ffd 100644 --- a/tests/test_oiejq.py +++ b/tests/test_oiejq.py @@ -11,12 +11,23 @@ def test_install_oiejq(): if sys.platform != 'linux': return - shutil.rmtree(os.path.expanduser('~/.local/bin/'), ignore_errors=True) + try: + os.remove(os.path.expanduser('~/.local/bin/oiejq')) + os.remove(os.path.expanduser('~/.local/bin/sio2jail')) + except IsADirectoryError: + shutil.rmtree(os.path.expanduser('~/.local/bin/oiejq'), ignore_errors=True) + except FileNotFoundError: + pass assert not oiejq.check_oiejq() assert oiejq.install_oiejq() assert oiejq.get_oiejq_path() == os.path.expanduser('~/.local/bin/oiejq') - shutil.rmtree(os.path.expanduser('~/.local/bin/'), ignore_errors=True) + try: + os.remove(os.path.expanduser('~/.local/bin/oiejq')) + os.remove(os.path.expanduser('~/.local/bin/sio2jail')) + except FileNotFoundError: + pass + assert not oiejq.check_oiejq() os.makedirs(os.path.expanduser('~/.local/bin/oiejq')) with pytest.raises(SystemExit): @@ -28,7 +39,14 @@ def test_check_oiejq(): if sys.platform != 'linux': return - shutil.rmtree(os.path.expanduser('~/.local/bin/'), ignore_errors=True) + try: + os.remove(os.path.expanduser('~/.local/bin/oiejq')) + os.remove(os.path.expanduser('~/.local/bin/sio2jail')) + except IsADirectoryError: + shutil.rmtree(os.path.expanduser('~/.local/bin/oiejq'), ignore_errors=True) + except FileNotFoundError: + pass + assert not oiejq.check_oiejq() os.makedirs(os.path.expanduser('~/.local/bin/oiejq'), exist_ok=True) assert not oiejq.check_oiejq()