testgres.os-ops 2.0.2__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. {testgres_os_ops-2.0.2/testgres.os_ops.egg-info → testgres_os_ops-2.1.0}/PKG-INFO +1 -1
  2. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/pyproject.toml +9 -1
  3. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/src/local_ops.py +4 -0
  4. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/src/os_ops.py +3 -0
  5. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/src/remote_ops.py +6 -4
  6. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0/testgres.os_ops.egg-info}/PKG-INFO +1 -1
  7. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/tests/test_os_ops_common.py +14 -0
  8. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/LICENSE +0 -0
  9. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/README.md +0 -0
  10. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/setup.cfg +0 -0
  11. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/src/exceptions.py +0 -0
  12. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/src/helpers.py +0 -0
  13. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/src/raise_error.py +0 -0
  14. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/testgres.os_ops.egg-info/SOURCES.txt +0 -0
  15. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/testgres.os_ops.egg-info/dependency_links.txt +0 -0
  16. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/testgres.os_ops.egg-info/requires.txt +0 -0
  17. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/testgres.os_ops.egg-info/top_level.txt +0 -0
  18. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/tests/test_os_ops_local.py +0 -0
  19. {testgres_os_ops-2.0.2 → testgres_os_ops-2.1.0}/tests/test_os_ops_remote.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testgres.os_ops
3
- Version: 2.0.2
3
+ Version: 2.1.0
4
4
  Summary: Testgres subsystem to work with OS
5
5
  Author-email: Postgres Professional <testgres@postgrespro.ru>
6
6
  License: PostgreSQL
@@ -9,9 +9,17 @@ build-backend = "setuptools.build_meta"
9
9
  extend-ignore = ["E501"]
10
10
  exclude = [".git", "__pycache__", "env", "venv"]
11
11
 
12
+ # Pytest settings
13
+ [tool.pytest.ini_options]
14
+
15
+ testpaths = ["tests"]
16
+ log_file_level = "NOTSET"
17
+ log_file_format = "%(levelname)8s [%(asctime)s] %(message)s"
18
+ log_file_date_format = "%Y-%m-%d %H:%M:%S"
19
+
12
20
  [project]
13
21
  name = "testgres.os_ops"
14
- version = "2.0.2"
22
+ version = "2.1.0"
15
23
 
16
24
  description = "Testgres subsystem to work with OS"
17
25
  readme = "README.md"
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
  import getpass
4
4
  import logging
5
5
  import os
6
+ import sys
6
7
  import shutil
7
8
  import stat
8
9
  import subprocess
@@ -75,6 +76,9 @@ class LocalOperations(OsOperations):
75
76
  assert type(__class__.sm_single_instance) == __class__ # noqa: E721
76
77
  return __class__.sm_single_instance
77
78
 
79
+ def get_platform(self) -> str:
80
+ return str(sys.platform)
81
+
78
82
  def create_clone(self) -> LocalOperations:
79
83
  clone = __class__(__class__.sm_dummy_conn_params)
80
84
  clone.conn_params = copy.copy(self.conn_params)
@@ -23,6 +23,9 @@ class OsOperations:
23
23
  def __init__(self):
24
24
  pass
25
25
 
26
+ def get_platform(self) -> str:
27
+ raise NotImplementedError()
28
+
26
29
  def create_clone(self) -> OsOperations:
27
30
  raise NotImplementedError()
28
31
 
@@ -3,7 +3,6 @@ from __future__ import annotations
3
3
  import getpass
4
4
  import os
5
5
  import posixpath
6
- import platform
7
6
  import subprocess
8
7
  import tempfile
9
8
  import io
@@ -47,6 +46,9 @@ class PsUtilProcessProxy:
47
46
 
48
47
 
49
48
  class RemoteOperations(OsOperations):
49
+ #
50
+ # Target system is Linux only.
51
+ #
50
52
  sm_dummy_conn_params = ConnectionParams()
51
53
 
52
54
  conn_params: ConnectionParams
@@ -59,9 +61,6 @@ class RemoteOperations(OsOperations):
59
61
  ssh_dest: str
60
62
 
61
63
  def __init__(self, conn_params: ConnectionParams):
62
- if not platform.system().lower() == "linux":
63
- raise EnvironmentError("Remote operations are supported only on Linux!")
64
-
65
64
  if conn_params is None:
66
65
  raise ValueError("Argument 'conn_params' is None.")
67
66
 
@@ -86,6 +85,9 @@ class RemoteOperations(OsOperations):
86
85
  def __enter__(self):
87
86
  return self
88
87
 
88
+ def get_platform(self) -> str:
89
+ return "linux"
90
+
89
91
  def create_clone(self) -> RemoteOperations:
90
92
  clone = __class__(__class__.sm_dummy_conn_params)
91
93
  clone.conn_params = copy.copy(self.conn_params)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testgres.os_ops
3
- Version: 2.0.2
3
+ Version: 2.1.0
4
4
  Summary: Testgres subsystem to work with OS
5
5
  Author-email: Postgres Professional <testgres@postgrespro.ru>
6
6
  License: PostgreSQL
@@ -42,6 +42,20 @@ class TestOsOpsCommon:
42
42
  assert isinstance(request.param, OsOperations)
43
43
  return request.param
44
44
 
45
+ def test_get_platform(self, os_ops: OsOperations):
46
+ assert isinstance(os_ops, OsOperations)
47
+ p = os_ops.get_platform()
48
+ assert p is not None
49
+ assert type(p) == str # noqa: E721
50
+ assert p == sys.platform
51
+
52
+ def test_get_platform__is_known(self, os_ops: OsOperations):
53
+ assert isinstance(os_ops, OsOperations)
54
+ p = os_ops.get_platform()
55
+ assert p is not None
56
+ assert type(p) == str # noqa: E721
57
+ assert p in {"win32", "linux"}
58
+
45
59
  def test_create_clone(self, os_ops: OsOperations):
46
60
  assert isinstance(os_ops, OsOperations)
47
61
  clone = os_ops.create_clone()
File without changes