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

Commitcb87d0a

Browse files
tests.helpers.RunConditions is added
RunConditions contains the code to check the execution condition of tests.It is used in TestLocalOperations.
1 parent1c64337 commitcb87d0a

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

‎tests/__init__.py

Whitespace-only changes.

‎tests/helpers/__init__.py

Whitespace-only changes.

‎tests/helpers/run_conditions.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
importpytest
2+
importplatform
3+
4+
5+
classRunConditions:
6+
# It is not a test kit!
7+
__test__=False
8+
9+
defskip_if_windows():
10+
ifplatform.system().lower()=="windows":
11+
pytest.skip("This test does not support Windows.")

‎tests/test_local.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
importpytest
2-
importplatform
32

43
fromtestgresimportExecUtilException
54
fromtestgresimportLocalOperations
65

6+
from .helpers.run_conditionsimportRunConditions
7+
78

89
classTestLocalOperations:
910

1011
@pytest.fixture(scope="function",autouse=True)
1112
defsetup(self):
1213
self.operations=LocalOperations()
1314

14-
defskip_if_windows():
15-
ifplatform.system().lower()=="windows":
16-
pytest.skip("This test does not support Windows.")
17-
1815
deftest_exec_command_success(self):
1916
"""
2017
Test exec_command for successful command execution.
2118
"""
22-
__class__.skip_if_windows()
19+
RunConditions.skip_if_windows()
2320

2421
cmd="python3 --version"
2522
response=self.operations.exec_command(cmd,wait_exit=True,shell=True)
@@ -30,7 +27,7 @@ def test_exec_command_failure(self):
3027
"""
3128
Test exec_command for command execution failure.
3229
"""
33-
__class__.skip_if_windows()
30+
RunConditions.skip_if_windows()
3431

3532
cmd="nonexistent_command"
3633
whileTrue:
@@ -46,7 +43,7 @@ def test_exec_command_failure__expect_error(self):
4643
"""
4744
Test exec_command for command execution failure.
4845
"""
49-
__class__.skip_if_windows()
46+
RunConditions.skip_if_windows()
5047

5148
cmd="nonexistent_command"
5249

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp