File: test_platform.py

package info (click to toggle)
python-easydev 0.10.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 504 kB
  • sloc: python: 2,130; javascript: 49; makefile: 13
file content (32 lines) | stat: -rw-r--r-- 794 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import easydev
from easydev.platform import get_platform, is_windows
from easydev.platform import is_linux, is_mac


def test_platform(mocker):

    assert get_platform() in ['Linux', 'Windows', 'Mac']


    is_windows()
    is_linux()
    is_mac()

    """def func():
        raise Exception
    with patch("platform.linux_distribution", func):
        get_platform()
    """

    mocker.patch.object(easydev.platform, "get_platform")
    easydev.platform.get_platform.return_value = "Windows"
    assert is_linux() is False
    assert is_mac() is False
    assert is_windows() is True

    mocker.patch.object(easydev.platform, "get_platform")
    easydev.platform.get_platform.return_value = "Mac"
    assert is_linux() is False
    assert is_windows() is False
    assert is_mac() is True