Skip to content

Commit

Permalink
Merge pull request #1143 from nstelter-slac/suppress_expected_warning…
Browse files Browse the repository at this point in the history
…s_tests

MNT: stop warnings during tests from using deprecated .command property
  • Loading branch information
jbellister-slac authored Dec 20, 2024
2 parents 70f3fd7 + 7ab612e commit dd6f38a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pydm/tests/widgets/test_shell_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ def test_construct(qtbot, command, title):
assert test_icon_image == shell_cmd_icon_image


@pytest.mark.filterwarnings("ignore:'PyDMShellCommand.command' is deprecated")
def test_deprecated_command_property_with_no_commands(qtbot):
pydm_shell_command = PyDMShellCommand()
qtbot.addWidget(pydm_shell_command)
pydm_shell_command.command = "test"
assert pydm_shell_command.commands == ["test"]


@pytest.mark.filterwarnings("ignore:'PyDMShellCommand.command' is deprecated")
def test_deprecated_command_property_with_commands(qtbot):
pydm_shell_command = PyDMShellCommand()
qtbot.addWidget(pydm_shell_command)
Expand All @@ -122,15 +124,15 @@ def test_no_crash_without_any_commands(qtbot):
def test_no_crash_with_none_command(qtbot):
pydm_shell_command = PyDMShellCommand()
qtbot.addWidget(pydm_shell_command)
pydm_shell_command.command = None
pydm_shell_command.commands = None
qtbot.mouseClick(pydm_shell_command, QtCore.Qt.LeftButton)


def test_no_error_without_env_variable(qtbot, caplog):
"""Verify that the shell command works when the environment variable property is saved as an empty string"""
pydm_shell_command = PyDMShellCommand()
qtbot.addWidget(pydm_shell_command)
pydm_shell_command.command = "echo hello"
pydm_shell_command.commands = ["echo hello"]
pydm_shell_command.environmentVariables = ""
qtbot.mouseClick(pydm_shell_command, QtCore.Qt.LeftButton)
assert "error" not in caplog.text.lower()
Expand Down

0 comments on commit dd6f38a

Please sign in to comment.