Skip to content

Commit

Permalink
Don't run TUI tests if curses isn't found
Browse files Browse the repository at this point in the history
  • Loading branch information
vkottler committed Oct 15, 2023
1 parent a47774b commit 13a302b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/test_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

# built-in
import importlib
from subprocess import check_output
from sys import executable
from unittest.mock import patch
Expand Down Expand Up @@ -35,8 +36,13 @@ def test_package_entry():
def test_entry_tui_cmd():
"""Test basic usages of the 'tui' command."""

base = base_args("tui")
try:
# Only run these tests if the curses module is present.
importlib.import_module("curses")
base = base_args("tui")

with patch("runtimepy.commands.tui._curses.wrapper", new=wrapper_mock):
# Only run 20 iterations.
assert runtimepy_main(base + ["-i", "20"]) == 0
with patch("runtimepy.commands.tui._curses.wrapper", new=wrapper_mock):
# Only run 20 iterations.
assert runtimepy_main(base + ["-i", "20"]) == 0
except ImportError:
pass

0 comments on commit 13a302b

Please sign in to comment.