Skip to content

Commit

Permalink
Update github-runner tests (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
adespawn committed Mar 6, 2024
1 parent cbf6a08 commit eb77c24
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions tests/test_oiejq.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()
Expand Down

0 comments on commit eb77c24

Please sign in to comment.