Skip to content

Commit

Permalink
test: use Python interp for sleep test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dbohdan committed Oct 14, 2024
1 parent 1fc3b7b commit 0f1b78a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test_memsparkline.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
import unittest
from pathlib import Path

PYTHON = sys.executable
TEST_PATH = Path(__file__).resolve().parent

COMMAND = shlex.split(os.environ.get("MEMSPARKLINE_COMMAND", ""))
if COMMAND == []:
COMMAND = [sys.executable, "-m", "memsparkline"]
COMMAND = [PYTHON, "-m", "memsparkline"]


def run(
Expand Down Expand Up @@ -128,8 +130,8 @@ class TestMemsparklineWindows(unittest.TestCase):
def test_cmd_basic(self) -> None:
assert re.search("(?s).*avg:.*max:", run("cmd.exe", "/c", "dir"))

def test_cmd_pause(self) -> None:
stderr = run("-w", "2000", "cmd", "/c", "timeout", "/t", "1")
def test_python_sleep(self) -> None:
stderr = run("-w", "2000", PYTHON, "-c", "import time; time.sleep(1)")

assert len(stderr.split("\n")) == 5

Expand Down

0 comments on commit 0f1b78a

Please sign in to comment.