iker-python-common 1.0.67__tar.gz → 1.0.69__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.
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/PKG-INFO +1 -1
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/config.py +12 -8
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/csvutils.py +6 -6
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/retry.py +2 -2
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/shutils.py +21 -9
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/testutils.py +0 -7
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker_python_common.egg-info/PKG-INFO +1 -1
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/config_test.py +2 -3
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/csvutils_test.py +2 -3
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/shutils_test.py +8 -8
- iker_python_common-1.0.69/test/testenv.py +15 -0
- iker_python_common-1.0.67/test/testenv.py +0 -15
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/.editorconfig +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/.github/workflows/pr.yml +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/.github/workflows/push.yml +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/.gitignore +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/MANIFEST.in +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/README.md +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/VERSION +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/pyproject.toml +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/config/config.cfg +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/csvutils/data.csv +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/csvutils/data.tsv +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.baz/file.bar.baz +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.baz/file.foo.bar +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.baz/file.foo.baz +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.foo/dir.foo.bar/dir.foo.bar.baz/file.foo.bar.baz +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.foo/dir.foo.bar/file.bar.baz +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.foo/dir.foo.bar/file.foo.bar +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.foo/dir.foo.bar/file.foo.baz +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.foo/file.bar +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.foo/file.baz +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.foo/file.foo +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/setup.cfg +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/setup.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/__init__.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/__init__.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/argutils.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/dbutils.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/dtutils.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/funcutils.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/iterutils.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/jsonutils.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/logger.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/numutils.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/randutils.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/span.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/strutils.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker/common/utils/typeutils.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker_python_common.egg-info/SOURCES.txt +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker_python_common.egg-info/dependency_links.txt +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker_python_common.egg-info/not-zip-safe +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker_python_common.egg-info/requires.txt +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker_python_common.egg-info/top_level.txt +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/__init__.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/__init__.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/__init__.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/argutils_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/dbutils_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/dtutils_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/funcutils_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/iterutils_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/jsonutils_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/logger_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/numutils_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/randutils_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/retry_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/span_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/strutils_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/testutils_test.py +0 -0
- {iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/typeutils_test.py +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import configparser
|
|
2
|
-
import os
|
|
2
|
+
import os
|
|
3
|
+
import pathlib
|
|
3
4
|
from typing import Self
|
|
4
5
|
|
|
5
6
|
from iker.common.utils import logger
|
|
@@ -7,8 +8,11 @@ from iker.common.utils.strutils import is_blank, trim_to_empty
|
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class Config(object):
|
|
10
|
-
def __init__(self, config_path: str = None):
|
|
11
|
-
|
|
11
|
+
def __init__(self, config_path: str | os.PathLike[str] | None = None):
|
|
12
|
+
if not is_blank(config_path := trim_to_empty(None if config_path is None else str(config_path))):
|
|
13
|
+
self.config_path = pathlib.Path(config_path)
|
|
14
|
+
else:
|
|
15
|
+
self.config_path = None
|
|
12
16
|
self.config_parser: configparser.RawConfigParser = configparser.RawConfigParser(strict=False)
|
|
13
17
|
|
|
14
18
|
def __len__(self):
|
|
@@ -23,26 +27,26 @@ class Config(object):
|
|
|
23
27
|
|
|
24
28
|
def restore(self) -> bool:
|
|
25
29
|
self.config_parser = configparser.RawConfigParser(strict=False)
|
|
26
|
-
if
|
|
30
|
+
if self.config_path is None:
|
|
27
31
|
return False
|
|
28
32
|
try:
|
|
29
|
-
if not
|
|
33
|
+
if not self.config_path.exists():
|
|
30
34
|
raise IOError("file not found")
|
|
31
35
|
self.config_parser.read(self.config_path, encoding="utf-8")
|
|
32
36
|
return True
|
|
33
37
|
except IOError as e:
|
|
34
|
-
logger.exception("Failed to restore config from file '%s'", self.config_path)
|
|
38
|
+
logger.exception("Failed to restore config from file <'%s'>", self.config_path)
|
|
35
39
|
return False
|
|
36
40
|
|
|
37
41
|
def persist(self) -> bool:
|
|
38
|
-
if
|
|
42
|
+
if self.config_path is None:
|
|
39
43
|
return False
|
|
40
44
|
try:
|
|
41
45
|
with open(self.config_path, "w") as fh:
|
|
42
46
|
self.config_parser.write(fh)
|
|
43
47
|
return True
|
|
44
48
|
except IOError as e:
|
|
45
|
-
logger.exception("Failed to persist config to file '%s'", self.config_path)
|
|
49
|
+
logger.exception("Failed to persist config to file <'%s'>", self.config_path)
|
|
46
50
|
return False
|
|
47
51
|
|
|
48
52
|
def has_section(self, section: str) -> bool:
|
|
@@ -153,7 +153,7 @@ class CSVView(object):
|
|
|
153
153
|
@overload
|
|
154
154
|
def load_file(
|
|
155
155
|
self,
|
|
156
|
-
file_path: os.PathLike
|
|
156
|
+
file_path: str | os.PathLike[str],
|
|
157
157
|
has_header: bool,
|
|
158
158
|
ret_dict: False = False,
|
|
159
159
|
**kwargs,
|
|
@@ -163,7 +163,7 @@ class CSVView(object):
|
|
|
163
163
|
@overload
|
|
164
164
|
def load_file(
|
|
165
165
|
self,
|
|
166
|
-
file_path: os.PathLike
|
|
166
|
+
file_path: str | os.PathLike[str],
|
|
167
167
|
ret_dict: False = False,
|
|
168
168
|
**kwargs,
|
|
169
169
|
) -> Generator[list[Any], None, None]:
|
|
@@ -172,7 +172,7 @@ class CSVView(object):
|
|
|
172
172
|
@overload
|
|
173
173
|
def load_file(
|
|
174
174
|
self,
|
|
175
|
-
file_path: os.PathLike
|
|
175
|
+
file_path: str | os.PathLike[str],
|
|
176
176
|
has_header: bool,
|
|
177
177
|
ret_dict: True = True,
|
|
178
178
|
**kwargs,
|
|
@@ -182,7 +182,7 @@ class CSVView(object):
|
|
|
182
182
|
@overload
|
|
183
183
|
def load_file(
|
|
184
184
|
self,
|
|
185
|
-
file_path: os.PathLike
|
|
185
|
+
file_path: str | os.PathLike[str],
|
|
186
186
|
ret_dict: True = True,
|
|
187
187
|
**kwargs,
|
|
188
188
|
) -> Generator[dict[str, Any], None, None]:
|
|
@@ -190,7 +190,7 @@ class CSVView(object):
|
|
|
190
190
|
|
|
191
191
|
def load_file(
|
|
192
192
|
self,
|
|
193
|
-
file_path: os.PathLike
|
|
193
|
+
file_path: str | os.PathLike[str],
|
|
194
194
|
has_header: bool = True,
|
|
195
195
|
ret_dict: bool = False,
|
|
196
196
|
**kwargs,
|
|
@@ -215,7 +215,7 @@ class CSVView(object):
|
|
|
215
215
|
def dump_file(
|
|
216
216
|
self,
|
|
217
217
|
data: Iterable[Sequence[Any] | Mapping[str, Any]],
|
|
218
|
-
file_path: os.PathLike
|
|
218
|
+
file_path: str | os.PathLike[str],
|
|
219
219
|
has_header: bool = True,
|
|
220
220
|
**kwargs,
|
|
221
221
|
) -> None:
|
|
@@ -165,11 +165,11 @@ class RetryWrapper(object):
|
|
|
165
165
|
else:
|
|
166
166
|
return self.target(*args, **kwargs)
|
|
167
167
|
except Exception as e:
|
|
168
|
-
logger.exception("Function target '%s' failed on attempt
|
|
168
|
+
logger.exception("Function target <'%s'> failed on attempt <%d>", self.target, attempt_number)
|
|
169
169
|
last_exception = e
|
|
170
170
|
time.sleep(self.next_wait(attempt_number))
|
|
171
171
|
|
|
172
|
-
raise RuntimeError(f"failed to execute function target '{self.target}' after
|
|
172
|
+
raise RuntimeError(f"failed to execute function target '{self.target}' after {attempt_number} attempts")
|
|
173
173
|
|
|
174
174
|
|
|
175
175
|
def retry(wait: int = None, retrials: int = None, timeout: int = None):
|
|
@@ -11,6 +11,7 @@ __all__ = [
|
|
|
11
11
|
"extensions",
|
|
12
12
|
"stem",
|
|
13
13
|
"expanded_path",
|
|
14
|
+
"norm_path",
|
|
14
15
|
"path_depth",
|
|
15
16
|
"glob_match",
|
|
16
17
|
"listfile",
|
|
@@ -20,7 +21,7 @@ __all__ = [
|
|
|
20
21
|
]
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
def extension(filename: str) -> str:
|
|
24
|
+
def extension(filename: str | os.PathLike[str]) -> str:
|
|
24
25
|
"""
|
|
25
26
|
Extracts the filename extension from the given filename or path.
|
|
26
27
|
|
|
@@ -31,7 +32,7 @@ def extension(filename: str) -> str:
|
|
|
31
32
|
return result
|
|
32
33
|
|
|
33
34
|
|
|
34
|
-
def stem(filename: str, minimal: bool = False) -> str:
|
|
35
|
+
def stem(filename: str | os.PathLike[str], minimal: bool = False) -> str:
|
|
35
36
|
"""
|
|
36
37
|
Extracts the filename stem from the given filename or path.
|
|
37
38
|
|
|
@@ -51,7 +52,7 @@ def stem(filename: str, minimal: bool = False) -> str:
|
|
|
51
52
|
return base[:-len(maximal_extension)]
|
|
52
53
|
|
|
53
54
|
|
|
54
|
-
def extensions(filename: str) -> list[str]:
|
|
55
|
+
def extensions(filename: str | os.PathLike[str]) -> list[str]:
|
|
55
56
|
"""
|
|
56
57
|
Extracts all filename extensions and compound extensions from the given filename or path.
|
|
57
58
|
|
|
@@ -69,7 +70,7 @@ def extensions(filename: str) -> list[str]:
|
|
|
69
70
|
return list(tail_iter(results))
|
|
70
71
|
|
|
71
72
|
|
|
72
|
-
def expanded_path(path: str) -> str:
|
|
73
|
+
def expanded_path(path: str | os.PathLike[str]) -> str:
|
|
73
74
|
"""
|
|
74
75
|
Returns the absolute expanded path, expanding environment variables and the home tilde.
|
|
75
76
|
|
|
@@ -79,7 +80,18 @@ def expanded_path(path: str) -> str:
|
|
|
79
80
|
return os.path.abspath(os.path.expanduser(os.path.expandvars(path)))
|
|
80
81
|
|
|
81
82
|
|
|
82
|
-
def
|
|
83
|
+
def norm_path(path: str | os.PathLike[str]) -> str:
|
|
84
|
+
"""
|
|
85
|
+
Returns the normalized path, collapsing redundant separators and up-level references.
|
|
86
|
+
|
|
87
|
+
:param path: The given path.
|
|
88
|
+
:return: The normalized path.
|
|
89
|
+
"""
|
|
90
|
+
_, path = os.path.splitdrive(os.path.normpath(path))
|
|
91
|
+
return path
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def path_depth(root: str | os.PathLike[str], child: str | os.PathLike[str]) -> int:
|
|
83
95
|
"""
|
|
84
96
|
Returns the relative path depth from the given ``child`` to the ``root``.
|
|
85
97
|
|
|
@@ -118,11 +130,11 @@ def glob_match(
|
|
|
118
130
|
|
|
119
131
|
|
|
120
132
|
class CopyFuncProtocol(Protocol):
|
|
121
|
-
def __call__(self, src: str, dst: str, **kwargs) -> None: ...
|
|
133
|
+
def __call__(self, src: str | os.PathLike[str], dst: str | os.PathLike[str], **kwargs) -> None: ...
|
|
122
134
|
|
|
123
135
|
|
|
124
136
|
def listfile(
|
|
125
|
-
path: str,
|
|
137
|
+
path: str | os.PathLike[str],
|
|
126
138
|
*,
|
|
127
139
|
include_patterns: list[str] | None = None,
|
|
128
140
|
exclude_patterns: list[str] | None = None,
|
|
@@ -153,8 +165,8 @@ def listfile(
|
|
|
153
165
|
|
|
154
166
|
|
|
155
167
|
def copy(
|
|
156
|
-
src: str,
|
|
157
|
-
dst: str,
|
|
168
|
+
src: str | os.PathLike[str],
|
|
169
|
+
dst: str | os.PathLike[str],
|
|
158
170
|
*,
|
|
159
171
|
include_patterns: list[str] | None = None,
|
|
160
172
|
exclude_patterns: list[str] | None = None,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import abc
|
|
2
|
-
import os
|
|
3
2
|
from decimal import Decimal
|
|
4
3
|
from typing import Any, Protocol
|
|
5
4
|
|
|
@@ -9,7 +8,6 @@ from _pytest.python_api import ApproxBase, ApproxDecimal, ApproxMapping, ApproxS
|
|
|
9
8
|
from iker.common.utils.numutils import to_decimal
|
|
10
9
|
|
|
11
10
|
__all__ = [
|
|
12
|
-
"norm_path",
|
|
13
11
|
"nested_approx",
|
|
14
12
|
"MockedCallable",
|
|
15
13
|
"CalleeMock",
|
|
@@ -18,11 +16,6 @@ __all__ = [
|
|
|
18
16
|
]
|
|
19
17
|
|
|
20
18
|
|
|
21
|
-
def norm_path(s: str) -> str:
|
|
22
|
-
_, path = os.path.splitdrive(os.path.normpath(s))
|
|
23
|
-
return path
|
|
24
|
-
|
|
25
|
-
|
|
26
19
|
class ApproxNestedMixin(ApproxBase):
|
|
27
20
|
def __repr__(self) -> str:
|
|
28
21
|
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/config_test.py
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import os.path
|
|
2
1
|
import unittest
|
|
3
2
|
|
|
4
3
|
import ddt
|
|
@@ -299,7 +298,7 @@ class ConfigTest(unittest.TestCase):
|
|
|
299
298
|
self.assertEqual(len(config), 0)
|
|
300
299
|
|
|
301
300
|
def test_restore__from_file(self):
|
|
302
|
-
config = Config(
|
|
301
|
+
config = Config(resources_directory / "unittest" / "config" / "config.cfg")
|
|
303
302
|
|
|
304
303
|
tuples = [
|
|
305
304
|
("dummy_section_1", "dummy_option_1", "True"),
|
|
@@ -322,7 +321,7 @@ class ConfigTest(unittest.TestCase):
|
|
|
322
321
|
self.assertEqual(config.get(section, option), value)
|
|
323
322
|
|
|
324
323
|
def test_restore__file_not_found(self):
|
|
325
|
-
config = Config(
|
|
324
|
+
config = Config(resources_directory / "unittest" / "config" / "missing_config.cfg")
|
|
326
325
|
|
|
327
326
|
self.assertFalse(config.restore())
|
|
328
327
|
self.assertEqual(len(config), 0)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import itertools
|
|
2
2
|
import math
|
|
3
|
-
import os.path
|
|
4
3
|
import unittest
|
|
5
4
|
|
|
6
5
|
import ddt
|
|
@@ -227,10 +226,10 @@ class CSVTest(unittest.TestCase):
|
|
|
227
226
|
[None, None, None, None, None, None],
|
|
228
227
|
]
|
|
229
228
|
|
|
230
|
-
for c, t, d in zip(view_csv.load_file(
|
|
229
|
+
for c, t, d in zip(view_csv.load_file(resources_directory / "unittest" / "csvutils" / "data.csv",
|
|
231
230
|
has_header=True,
|
|
232
231
|
encoding="utf-8"),
|
|
233
|
-
view_tsv.load_file(
|
|
232
|
+
view_tsv.load_file(resources_directory / "unittest" / "csvutils" / "data.tsv",
|
|
234
233
|
has_header=True,
|
|
235
234
|
encoding="utf-8"),
|
|
236
235
|
data):
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/shutils_test.py
RENAMED
|
@@ -6,10 +6,9 @@ import unittest
|
|
|
6
6
|
import ddt
|
|
7
7
|
|
|
8
8
|
from iker.common.utils.shutils import copy, listfile
|
|
9
|
-
from iker.common.utils.shutils import expanded_path, path_depth
|
|
9
|
+
from iker.common.utils.shutils import expanded_path, norm_path, path_depth
|
|
10
10
|
from iker.common.utils.shutils import extension, extensions, stem
|
|
11
11
|
from iker.common.utils.shutils import glob_match
|
|
12
|
-
from iker.common.utils.testutils import norm_path
|
|
13
12
|
from testenv import resources_directory
|
|
14
13
|
|
|
15
14
|
work_dir = pathlib.Path.cwd
|
|
@@ -415,11 +414,11 @@ class ShUtilsTest(unittest.TestCase):
|
|
|
415
414
|
@ddt.idata(data_listfile)
|
|
416
415
|
@ddt.unpack
|
|
417
416
|
def test_listfile(self, path, include_patterns, exclude_patterns, depth, expect):
|
|
418
|
-
self.assertSetEqual(set(map(norm_path, listfile(
|
|
417
|
+
self.assertSetEqual(set(map(norm_path, listfile(resources_directory / path,
|
|
419
418
|
include_patterns=include_patterns,
|
|
420
419
|
exclude_patterns=exclude_patterns,
|
|
421
420
|
depth=depth))),
|
|
422
|
-
set(map(norm_path, map(lambda x:
|
|
421
|
+
set(map(norm_path, map(lambda x: resources_directory / x, expect))))
|
|
423
422
|
|
|
424
423
|
data_copy = [
|
|
425
424
|
(
|
|
@@ -573,11 +572,12 @@ class ShUtilsTest(unittest.TestCase):
|
|
|
573
572
|
@ddt.unpack
|
|
574
573
|
def test_copy(self, src, dst, include_patterns, exclude_patterns, depth, expect):
|
|
575
574
|
with tempfile.TemporaryDirectory() as temp_directory:
|
|
576
|
-
|
|
577
|
-
|
|
575
|
+
temp_directory = pathlib.Path(temp_directory)
|
|
576
|
+
copy(resources_directory / src,
|
|
577
|
+
temp_directory / dst,
|
|
578
578
|
include_patterns=include_patterns,
|
|
579
579
|
exclude_patterns=exclude_patterns,
|
|
580
580
|
depth=depth)
|
|
581
581
|
|
|
582
|
-
self.assertSetEqual(set(map(norm_path, listfile(
|
|
583
|
-
set(map(norm_path, map(lambda x:
|
|
582
|
+
self.assertSetEqual(set(map(norm_path, listfile(temp_directory / dst))),
|
|
583
|
+
set(map(norm_path, map(lambda x: temp_directory / x, expect))))
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import pathlib
|
|
2
|
+
|
|
3
|
+
__all__ = [
|
|
4
|
+
"module_directory",
|
|
5
|
+
"source_directory",
|
|
6
|
+
"test_directory",
|
|
7
|
+
"resources_directory",
|
|
8
|
+
"temporary_directory",
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
module_directory: pathlib.Path = pathlib.Path(__file__).absolute().parent.parent
|
|
12
|
+
source_directory: pathlib.Path = module_directory / "src"
|
|
13
|
+
test_directory: pathlib.Path = module_directory / "test"
|
|
14
|
+
resources_directory: pathlib.Path = module_directory / "resources"
|
|
15
|
+
temporary_directory: pathlib.Path = module_directory / "tmp"
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
__all__ = [
|
|
4
|
-
"module_directory",
|
|
5
|
-
"source_directory",
|
|
6
|
-
"test_directory",
|
|
7
|
-
"resources_directory",
|
|
8
|
-
"temporary_directory",
|
|
9
|
-
]
|
|
10
|
-
|
|
11
|
-
module_directory: str = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
|
12
|
-
source_directory: str = os.path.abspath(os.path.join(module_directory, "src"))
|
|
13
|
-
test_directory: str = os.path.abspath(os.path.join(module_directory, "test"))
|
|
14
|
-
resources_directory: str = os.path.abspath(os.path.join(module_directory, "resources"))
|
|
15
|
-
temporary_directory: str = os.path.abspath(os.path.join(module_directory, "tmp"))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/config/config.cfg
RENAMED
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/csvutils/data.csv
RENAMED
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/csvutils/data.tsv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.foo/file.bar
RENAMED
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.foo/file.baz
RENAMED
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/resources/unittest/shutils/dir.foo/file.foo
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker_python_common.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker_python_common.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/src/iker_python_common.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/dbutils_test.py
RENAMED
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/dtutils_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/logger_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/retry_test.py
RENAMED
|
File without changes
|
{iker_python_common-1.0.67 → iker_python_common-1.0.69}/test/iker_tests/common/utils/span_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|