Skip to content

Commit

Permalink
- Updated a couple of tests for macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
eoyilmaz committed Nov 21, 2022
1 parent 501e93b commit 06a925d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
/DisplayCAL/__version__.py
/build/
/dist/
Expand All @@ -20,3 +21,4 @@ __pycache__/
/DisplayCAL/lib64/python38/*.so
/DisplayCAL/lib64/python39/*.so
/DisplayCAL/lib64/python310/*.so
/DisplayCAL/lib64/RealDisplaySizeMM.cpython-310-darwin.so
5 changes: 3 additions & 2 deletions tests/test_ICCProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Tests for the DisplayCAL.ICCProfile module."""
import binascii
import datetime
import sys
from time import strftime

from DisplayCAL import ICCProfile, colormath
Expand Down Expand Up @@ -37,7 +38,7 @@ def test_iccprofile_from_rgb_space():
["Color model", "RGB"],
["Profile connection space (PCS)", "XYZ"],
["Created", "2022-03-09 00:19:53"],
["Platform", "0x2A6E6978 '*nix'"],
["Platform", "Apple"] if sys.platform == "darwin" else ["Platform", "0x2A6E6978 '*nix'"],
["Is embedded", "No"],
["Can be used independently", "Yes"],
["Device", ""],
Expand Down Expand Up @@ -178,7 +179,7 @@ def test_iccprofile_get_info():
["Color model", "RGB"],
["Profile connection space (PCS)", "XYZ"],
["Created", "2022-02-14 02:44:22"],
["Platform", "0x2A6E6978 '*nix'"],
["Platform", "Apple"] if sys.platform == "darwin" else ["Platform", "0x2A6E6978 '*nix'"],
["Is embedded", "No"],
["Can be used independently", "Yes"],
["Device", ""],
Expand Down
10 changes: 6 additions & 4 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ def test_default_values_1():
assert config.pyext != "" # .py
# $HOME/Documents/development/displaycal/DisplayCAL
assert config.pydir != ""
assert config.xdg_config_dir_default == "/etc/xdg"
assert config.xdg_config_home == os.path.expanduser("~/.config")
assert config.xdg_data_home == os.path.expanduser("~/.local/share")
assert config.xdg_data_home_default == os.path.expanduser("~/.local/share")

if sys.platform == "linux":
assert config.xdg_config_dir_default == "/etc/xdg"
assert config.xdg_config_home == os.path.expanduser("~/.config")
assert config.xdg_data_home == os.path.expanduser("~/.local/share")
assert config.xdg_data_home_default == os.path.expanduser("~/.local/share")

# skip the rest of the test for now
return
Expand Down
9 changes: 8 additions & 1 deletion tests/test_real_display_size_mm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import annotations

import sys
from unittest import mock

import pytest
Expand All @@ -9,7 +10,11 @@
from DisplayCAL import RealDisplaySizeMM, config
from DisplayCAL.dev.mocks import check_call
from tests.data.display_data import DisplayData
from tests.data.fake_dbus import FakeDBusObject

try:
from tests.data.fake_dbus import FakeDBusObject
except ImportError:
pass


def test_real_display_size_mm():
Expand Down Expand Up @@ -112,6 +117,8 @@ def test_get_x_icc_profile_atom_id(function) -> None:
assert isinstance(result, int)


@pytest.mark.skipif('fake_dbus' not in sys.modules,
reason="requires the DBus library")
def test_get_wayland_display(monkeypatch: MonkeyPatch) -> None:
"""Test if wayland display is returned."""
with mock.patch.object(RealDisplaySizeMM, "DBusObject", new=FakeDBusObject):
Expand Down

0 comments on commit 06a925d

Please sign in to comment.