Skip to content

Commit

Permalink
test: skip to import qt ui libs for linux (#539)
Browse files Browse the repository at this point in the history
* test: skip to import qt ui libs for linux

Signed-off-by: Leon Li <[email protected]>
  • Loading branch information
AuxinJeron authored Dec 18, 2024
1 parent 81bfd20 commit ca15ded
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 22 deletions.
8 changes: 4 additions & 4 deletions requirements-testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ pytest == 7.*
pytest-cov == 5.*
pytest-timeout == 2.*
pytest-xdist == 3.*
pytest-qt == 4.*
pytest-xvfb == 3.*
PySide6-essentials < 6.6.2; python_version == '3.8'
PySide6-essentials >= 6.7.1; python_version > '3.8'
pytest-qt == 4.*; sys_platform != "linux"
pytest-xvfb == 3.*; sys_platform != "linux"
PySide6-essentials < 6.6.2; python_version == '3.8' and sys_platform != "linux"
PySide6-essentials >= 6.7.1; python_version > '3.8' and sys_platform != "linux"
freezegun == 1.*
types-pyyaml == 6.*
twine == 4.*; python_version == '3.7'
Expand Down
28 changes: 17 additions & 11 deletions test/unit/deadline_client/ui/widgets/test_host_requirements_tab.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

from deadline.client.ui.widgets.host_requirements_tab import (
HardwareRequirementsWidget,
CustomAmountWidget,
CustomAttributeWidget,
CustomAttributeValueWidget,
CustomRequirementsWidget,
ATTRIBUTE_CAPABILITY_PREFIX,
AMOUNT_CAPABILITY_PREFIX,
MIN_INT_VALUE,
MAX_INT_VALUE,
)
import pytest
from unittest.mock import MagicMock

try:
from deadline.client.ui.widgets.host_requirements_tab import (
HardwareRequirementsWidget,
CustomAmountWidget,
CustomAttributeWidget,
CustomAttributeValueWidget,
CustomRequirementsWidget,
ATTRIBUTE_CAPABILITY_PREFIX,
AMOUNT_CAPABILITY_PREFIX,
MIN_INT_VALUE,
MAX_INT_VALUE,
)
except ImportError:
# The tests in this file should be skipped if Qt UI related modules cannot be loaded
pytest.importorskip("deadline.client.ui.widgets.host_requirements_tab")


AMOUNT_NAME_MAX_LENGTH = 100 - len(AMOUNT_CAPABILITY_PREFIX)
ATTRIBUTE_NAME_MAX_LENGTH = 100 - len(ATTRIBUTE_CAPABILITY_PREFIX)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

from deadline.client.ui.widgets.openjd_parameters_widget import (
_JobTemplateLineEditWidget,
_JobTemplateIntSpinBoxWidget,
_JobTemplateFloatSpinBoxWidget,
)
import pytest
from conftest import STRING_FIELD_MAX_LENGHTH

try:
from deadline.client.ui.widgets.openjd_parameters_widget import (
_JobTemplateLineEditWidget,
_JobTemplateIntSpinBoxWidget,
_JobTemplateFloatSpinBoxWidget,
)
except ImportError:
# The tests in this file should be skipped if Qt UI related modules cannot be loaded
pytest.importorskip("deadline.client.ui.widgets.openjd_parameters_widget")


def test_input_in_line_edit_widget_should_be_truncated(qtbot):
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

import pytest
from deadline.client.ui.widgets.shared_job_settings_tab import SharedJobSettingsWidget
from deadline.client.ui.dataclasses import JobBundleSettings
from conftest import STRING_FIELD_MAX_LENGHTH

try:
from deadline.client.ui.widgets.shared_job_settings_tab import SharedJobSettingsWidget
from deadline.client.ui.dataclasses import JobBundleSettings
except ImportError:
# The tests in this file should be skipped if Qt UI related modules cannot be loaded
pytest.importorskip("deadline.client.ui.widgets.shared_job_settings_tab")


@pytest.fixture(scope="function")
def shared_job_settings_tab(qtbot, temp_job_bundle_dir) -> SharedJobSettingsWidget:
Expand Down

0 comments on commit ca15ded

Please sign in to comment.