Skip to content

RemoteOperations::exec_command must not raise an exception when 'expect_error' is True (#159) #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TestLocalOperations tests skip Windows
  • Loading branch information
Dmitry Kovalenko committed Dec 7, 2024
commit 1c64337682288201f4c163ad4f12afdca82e33cb
11 changes: 11 additions & 0 deletions tests/test_local.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
import platform

from testgres import ExecUtilException
from testgres import LocalOperations
Expand All @@ -10,10 +11,16 @@ class TestLocalOperations:
def setup(self):
self.operations = LocalOperations()

def skip_if_windows():
if platform.system().lower() == "windows":
pytest.skip("This test does not support Windows.")

def test_exec_command_success(self):
"""
Test exec_command for successful command execution.
"""
__class__.skip_if_windows()

cmd = "python3 --version"
response = self.operations.exec_command(cmd, wait_exit=True, shell=True)

Expand All @@ -23,6 +30,8 @@ def test_exec_command_failure(self):
"""
Test exec_command for command execution failure.
"""
__class__.skip_if_windows()

cmd = "nonexistent_command"
while True:
try:
Expand All @@ -37,6 +46,8 @@ def test_exec_command_failure__expect_error(self):
"""
Test exec_command for command execution failure.
"""
__class__.skip_if_windows()

cmd = "nonexistent_command"

exit_status, result, error = self.operations.exec_command(cmd, verbose=True, wait_exit=True, shell=True, expect_error=True)
Expand Down