Skip to content

Commit

Permalink
test(test_tmux_cmd_raises_on_not_found): Use monkeypatch
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Aug 28, 2022
1 parent c0e1138 commit 965aa66
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import re
import sys
import os
import typing as t
from distutils.version import LooseVersion
from typing import Optional
Expand All @@ -24,7 +23,7 @@
has_minimum_version,
has_version,
session_check_name,
tmux_cmd
tmux_cmd,
)
from libtmux.exc import BadSessionName, LibTmuxException, TmuxCommandNotFound
from libtmux.session import Session
Expand Down Expand Up @@ -174,16 +173,11 @@ def test_has_lte_version() -> None:
assert not has_lte_version("1.7b")


def test_tmux_cmd_raises_on_not_found() -> None:
previous_path = os.environ["PATH"]
os.environ["PATH"] = ""
def test_tmux_cmd_raises_on_not_found(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("PATH", "")
with pytest.raises(TmuxCommandNotFound):
tmux_cmd("-V")

os.environ["PATH"] = previous_path

tmux_cmd("-V")


def test_tmux_cmd_unicode(session: Session) -> None:
session.cmd("new-window", "-t", 3, "-n", "юникод", "-F", "Ελληνικά")
Expand Down

0 comments on commit 965aa66

Please sign in to comment.