mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 09:20:57 +01:00
16 lines
392 B
Python
16 lines
392 B
Python
![]() |
from contextlib import contextmanager
|
||
|
from unittest.mock import MagicMock
|
||
|
|
||
|
import builtins
|
||
|
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
|