コード例 #1
0
def test_display_trees_error(pb_resources):
    # noinspection PyUnresolvedReferences
    with mock.patch.dict('os.environ'):
        if 'DISPLAY' in os.environ:
            del os.environ['DISPLAY']
        with pytest.raises(SystemError):
            Pb.display_trees(pb_resources.get_one("o k"))
コード例 #2
0
ファイル: test_pb_api.py プロジェクト: cbird808/BuddySuite
def test_display_trees_error(pb_resources, monkeypatch):
    # noinspection PyUnresolvedReferences
    monkeypatch.setattr("builtins.input", lambda *_: "")
    monkeypatch.setattr(webbrowser, "open_new_tab", lambda *_: "")
    monkeypatch.setattr(os, "name", "posix")
    with mock.patch.dict('os.environ'):
        if 'DISPLAY' in os.environ:
            del os.environ['DISPLAY']

        with pytest.raises(SystemError):
            Pb.display_trees(pb_resources.get_one("o k"))
コード例 #3
0
ファイル: test_pb_api.py プロジェクト: cbird808/BuddySuite
def test_display_trees(monkeypatch, pb_resources):
    monkeypatch.setattr("builtins.input", lambda *_: "")
    monkeypatch.setattr(webbrowser, "open_new_tab", lambda *_: "")
    try:
        assert Pb.display_trees(pb_resources.get_one("o k"))
    except SystemError as err:
        assert "This system does not appear to be graphical, so display_trees() will not work." in str(err)
コード例 #4
0
def test_display_trees(monkeypatch, pb_resources):
    show = mock.Mock(return_value=True)
    monkeypatch.setattr(ete3.TreeNode, "show", show)
    try:
        assert Pb.display_trees(pb_resources.get_one("o k"))
    except SystemError as err:
        assert "This system is not graphical, so display_trees() will not work." in str(err)
コード例 #5
0
def test_display_trees_error():
    # noinspection PyUnresolvedReferences
    with mock.patch.dict('os.environ'):
        del os.environ['DISPLAY']
        with pytest.raises(SystemError):
            Pb.display_trees(Pb.make_copy(pb_objects[0]))
コード例 #6
0
def test_display_trees(monkeypatch):
    show = mock.Mock(return_value=True)
    monkeypatch.setattr(ete3.TreeNode, "show", show)
    assert Pb.display_trees(pb_resources.get_one("o k"))