Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes from1 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
PrevPrevious commit
tests.helpers.RunConditions is added
RunConditions contains the code to check the execution condition of tests.It is used in TestLocalOperations.
  • Loading branch information
@dmitry-lipetsk
dmitry-lipetsk committedDec 8, 2024
commitcb87d0a7b1c87a10c85787591c3d9ba4e6687e76
Empty file addedtests/__init__.py
View file
Open in desktop
Empty file.
Empty file addedtests/helpers/__init__.py
View file
Open in desktop
Empty file.
11 changes: 11 additions & 0 deletionstests/helpers/run_conditions.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
import pytest
import platform


class RunConditions:
# It is not a test kit!
__test__ = False

def skip_if_windows():
if platform.system().lower() == "windows":
pytest.skip("This test does not support Windows.")
13 changes: 5 additions & 8 deletionstests/test_local.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
import pytest
import platform

from testgres import ExecUtilException
from testgres import LocalOperations

from .helpers.run_conditions import RunConditions


class TestLocalOperations:

@pytest.fixture(scope="function", autouse=True)
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()
RunConditions.skip_if_windows()

cmd = "python3 --version"
response = self.operations.exec_command(cmd, wait_exit=True, shell=True)
Expand All@@ -30,7 +27,7 @@ def test_exec_command_failure(self):
"""
Test exec_command for command execution failure.
"""
__class__.skip_if_windows()
RunConditions.skip_if_windows()

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

cmd = "nonexistent_command"

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp