Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3350387
rmt: LocalCheck and OsOpsHelpers are added
dmitry-lipetsk Jul 2, 2026
3eae89b
rmt: test_makedirs_and_rmdirs_success is corrected
dmitry-lipetsk Jul 2, 2026
48d825a
rmt: test_mkdtemp__default is updated
dmitry-lipetsk Jul 2, 2026
e699fd7
rmt: test_mkdtemp__custom is updated
dmitry-lipetsk Jul 2, 2026
ad35feb
rmt: test_rmdirs is updated
dmitry-lipetsk Jul 2, 2026
4d760d6
rmt: test_rmdirs__01_with_subfolder is updated
dmitry-lipetsk Jul 2, 2026
3515039
rmt: test_rmdirs__02_with_file is updated
dmitry-lipetsk Jul 2, 2026
9de0d7a
rmt: test_rmdirs__03_with_subfolder_and_file is updated
dmitry-lipetsk Jul 2, 2026
8d93fda
rmt: test_rmdirs__try_to_delete_file is updated
dmitry-lipetsk Jul 2, 2026
6526ecf
rmt: test_get_file_size is updated
dmitry-lipetsk Jul 2, 2026
176892b
rmt: test_isfile_false__not_exist is updated
dmitry-lipetsk Jul 2, 2026
f2e5ed7
rmt: LocalCheck is updated
dmitry-lipetsk Jul 2, 2026
f42fb6d
rmt: test_isfile_false__directory is updated
dmitry-lipetsk Jul 2, 2026
67d9bfe
rmt: test_isdir_true is updated
dmitry-lipetsk Jul 2, 2026
ffa90bb
rmt: test_isdir_false__not_exist is updated
dmitry-lipetsk Jul 2, 2026
4a7577e
rmt: test_isdir_false__file is updated
dmitry-lipetsk Jul 2, 2026
032c902
rmt: test_write is updated
dmitry-lipetsk Jul 2, 2026
3f342c2
rmt: test_get_tempdir is updated
dmitry-lipetsk Jul 2, 2026
6f8f878
rmt: test_mkdir__mt is updated
dmitry-lipetsk Jul 2, 2026
76fa06c
rmt: test_get_dirname is updated
dmitry-lipetsk Jul 2, 2026
087e53f
rmt: LocalCheck is updated
dmitry-lipetsk Jul 2, 2026
98aa2b8
rmt: test_is_abs_path__yes is updated
dmitry-lipetsk Jul 2, 2026
8916cf8
rmt: test_is_abs_path__no is updated
dmitry-lipetsk Jul 2, 2026
4872fb2
rmt: test_is_port_free__xxx (true|false) are updated
dmitry-lipetsk Jul 2, 2026
8f8602f
rmt: test_get_tempdir__compare_with_py_info is updated
dmitry-lipetsk Jul 2, 2026
2838359
rmt: test_read__text is updated
dmitry-lipetsk Jul 3, 2026
bc9aabd
rmt: test_read_binary__spec is updated
dmitry-lipetsk Jul 3, 2026
9aba32b
rmt: test_read__binary is updated
dmitry-lipetsk Jul 3, 2026
7d53c28
rmt: test_path_exists_true__file is updated
dmitry-lipetsk Jul 3, 2026
d918719
rmt: test_isfile_true is updated
dmitry-lipetsk Jul 3, 2026
df00eda
rmt: test_kill and test_kill__unk_pid are updated and fixed
dmitry-lipetsk Jul 3, 2026
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
166 changes: 166 additions & 0 deletions tests/helpers/local_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# coding: utf-8
from .os_ops_helpers import OsOpsHelpers
from .os_ops_helpers import OsOperations

import os


class LocalCheck:
@staticmethod
def check_path_exists(
os_ops: OsOperations,
path: str,
) -> None:
assert isinstance(os_ops, OsOperations)
assert type(path) is str

if not OsOpsHelpers.is_localhost(os_ops):
return

if os.path.exists(path):
return

err_msg = "[LocalCheck] Local path [{}] does not exist.".format(
path,
)
raise RuntimeError(err_msg)

# --------------------------------------------------------------------
@staticmethod
def check_path_does_not_exists(
os_ops: OsOperations,
path: str,
) -> None:
assert isinstance(os_ops, OsOperations)
assert type(path) is str

if not OsOpsHelpers.is_localhost(os_ops):
return

if not os.path.exists(path):
return

err_msg = "[LocalCheck] Local path [{}] exists.".format(
path,
)
raise RuntimeError(err_msg)

# --------------------------------------------------------------------
@staticmethod
def check_isdir(
os_ops: OsOperations,
path: str,
) -> None:
assert isinstance(os_ops, OsOperations)
assert type(path) is str

if not OsOpsHelpers.is_localhost(os_ops):
return

if os.path.isdir(path):
return

err_msg = "[LocalCheck] Local path [{}] is not dir.".format(
path,
)
raise RuntimeError(err_msg)

# --------------------------------------------------------------------
@staticmethod
def check_not_isdir(
os_ops: OsOperations,
path: str,
) -> None:
assert isinstance(os_ops, OsOperations)
assert type(path) is str

if not OsOpsHelpers.is_localhost(os_ops):
return

if not os.path.isdir(path):
return

err_msg = "[LocalCheck] Local path [{}] is dir.".format(
path,
)
raise RuntimeError(err_msg)

# --------------------------------------------------------------------
@staticmethod
def check_isfile(
os_ops: OsOperations,
path: str,
) -> None:
assert isinstance(os_ops, OsOperations)
assert type(path) is str

if not OsOpsHelpers.is_localhost(os_ops):
return

if os.path.isfile(path):
return

err_msg = "[LocalCheck] Local path [{}] is not file.".format(
path,
)
raise RuntimeError(err_msg)

# --------------------------------------------------------------------
@staticmethod
def check_not_isfile(
os_ops: OsOperations,
path: str,
) -> None:
assert isinstance(os_ops, OsOperations)
assert type(path) is str

if not OsOpsHelpers.is_localhost(os_ops):
return

if not os.path.isfile(path):
return

err_msg = "[LocalCheck] Local path [{}] is file.".format(
path,
)
raise RuntimeError(err_msg)

# --------------------------------------------------------------------
@staticmethod
def check_path_is_abs(
os_ops: OsOperations,
path: str,
) -> None:
assert isinstance(os_ops, OsOperations)
assert type(path) is str

if not OsOpsHelpers.is_localhost(os_ops):
return

if os.path.isabs(path):
return

err_msg = "[LocalCheck] Local path [{}] is not abs.".format(
path,
)
raise RuntimeError(err_msg)

# --------------------------------------------------------------------
@staticmethod
def check_path_is_not_abs(
os_ops: OsOperations,
path: str,
) -> None:
assert isinstance(os_ops, OsOperations)
assert type(path) is str

if not OsOpsHelpers.is_localhost(os_ops):
return

if not os.path.isabs(path):
return

err_msg = "[LocalCheck] Local path [{}] is abs.".format(
path,
)
raise RuntimeError(err_msg)
18 changes: 18 additions & 0 deletions tests/helpers/os_ops_helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# coding: utf-8
from src.os_ops import OsOperations


class OsOpsHelpers:
@staticmethod
def is_localhost(os_ops: OsOperations) -> bool:
assert isinstance(os_ops, OsOperations)

host = os_ops.host

if host == "127.0.0.1":
return True

if host == "localhost":
return True

return False
Loading