File: test_platform.py

package info (click to toggle)
xonsh 0.13.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,024 kB
  • sloc: python: 46,350; makefile: 136; sh: 41; xml: 17
file content (20 lines) | stat: -rw-r--r-- 468 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import builtins
from contextlib import contextmanager
from unittest.mock import MagicMock

import xonsh.platform as xp


def test_githash_value_error(monkeypatch):
    @contextmanager
    def mocked_open(*args):
        yield MagicMock(read=lambda: "abc123")

    monkeypatch.setattr(builtins, "open", mocked_open)
    sha, date_ = xp.githash()
    assert date_ is None
    assert sha is None


def test_pathsplit_empty_path():
    assert xp.pathsplit("") == ("", "")