edq-utils 0.1.3__tar.gz → 0.1.4__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.
- {edq_utils-0.1.3 → edq_utils-0.1.4}/PKG-INFO +1 -1
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/__init__.py +1 -1
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/cli.py +33 -5
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq_utils.egg-info/PKG-INFO +1 -1
- {edq_utils-0.1.3 → edq_utils-0.1.4}/.github/workflows/main.yml +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/.gitignore +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/.mypy.ini +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/.pylintrc +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/LICENSE +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/README.md +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/cli/__init__.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/cli/config/__init__.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/cli/config/list.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/cli/http/__init__.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/cli/http/exchange-server.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/cli/http/send-exchange.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/cli/http/verify-exchanges.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/cli/testing/__init__.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/cli/testing/cli-test.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/cli/version.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/core/__init__.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/core/argparser.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/core/argparser_test.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/core/config.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/core/config_test.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/core/log.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/core/version.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/procedure/__init__.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/procedure/verify_exchanges.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/py.typed +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/__init__.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/asserts.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/cli_test.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/httpserver.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/httpserver_test.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/run.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/data/configs/empty/edq-config.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/data/configs/simple-1/edq-config.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/data/configs/simple-2/edq-config.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/data/configs/value-number/edq-config.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/tests/config/list/config_list_base.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/tests/config/list/config_list_config_value_number.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/tests/config/list/config_list_ignore_config.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/tests/config/list/config_list_no_config.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/tests/config/list/config_list_show_origin.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/tests/config/list/config_list_skip_header.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/tests/help_base.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/tests/platform_skip.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/tests/version_base.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_anchor.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_file.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_file_binary.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_file_get_params.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_file_multiple.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_file_name.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_file_post_multiple.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_file_post_params.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_headers.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_jsonresponse_dict.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_jsonresponse_list.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_params.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_post.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_post_params.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_post_urlparams.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_urlparams.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/specialcase_listparams_explicit.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/specialcase_listparams_url.httpex.json +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/files/a.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/files/tiny.png +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/unittest.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/__init__.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/dirent.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/dirent_test.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/hash.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/hash_test.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/json.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/json_test.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/net.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/pyimport.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/pyimport_test.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/reflection.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/time.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq/util/time_test.py +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq_utils.egg-info/SOURCES.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq_utils.egg-info/dependency_links.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq_utils.egg-info/requires.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/edq_utils.egg-info/top_level.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/pyproject.toml +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/requirements-dev.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/requirements.txt +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/scripts/build_site.sh +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/scripts/check_all.sh +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/scripts/check_lint.sh +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/scripts/check_python_version.sh +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/scripts/check_strict_types.sh +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/scripts/check_types.sh +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/scripts/gen_docs.sh +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/scripts/run_tests.sh +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/scripts/template/html/css/style.css +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/scripts/template/html/favicon.ico +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/scripts/template/html/images/favicon.png +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/scripts/template/html/index.html +0 -0
- {edq_utils-0.1.3 → edq_utils-0.1.4}/setup.cfg +0 -0
|
@@ -214,6 +214,22 @@ class CLITestInfo:
|
|
|
214
214
|
|
|
215
215
|
return CLITestInfo(test_name, base_dir, data_dir, temp_dir, **options)
|
|
216
216
|
|
|
217
|
+
@typing.runtime_checkable
|
|
218
|
+
class TestMethodWrapperFunction(typing.Protocol):
|
|
219
|
+
"""
|
|
220
|
+
A function that can be used to wrap/modify a CLI test method before it is attached to the test class.
|
|
221
|
+
"""
|
|
222
|
+
|
|
223
|
+
def __call__(self,
|
|
224
|
+
test_method: typing.Callable,
|
|
225
|
+
test_info_path: str,
|
|
226
|
+
) -> typing.Callable:
|
|
227
|
+
"""
|
|
228
|
+
Wrap and/or modify the CLI test method before it is attached to the test class.
|
|
229
|
+
See _get_test_method() for the input method.
|
|
230
|
+
The returned method will be used in-place of the input one.
|
|
231
|
+
"""
|
|
232
|
+
|
|
217
233
|
def read_test_file(path: str) -> typing.Tuple[typing.Dict[str, typing.Any], str]:
|
|
218
234
|
""" Read a test case file and split the output into JSON data and text. """
|
|
219
235
|
|
|
@@ -257,7 +273,9 @@ def replace_path_pattern(text: str, key: str, target_dir: str) -> str:
|
|
|
257
273
|
def _get_test_method(test_name: str, path: str, data_dir: str) -> typing.Callable:
|
|
258
274
|
""" Get a test method that represents the test case at the given path. """
|
|
259
275
|
|
|
260
|
-
def __method(self: edq.testing.unittest.BaseTest
|
|
276
|
+
def __method(self: edq.testing.unittest.BaseTest,
|
|
277
|
+
reraise_exception_types: typing.Union[typing.Tuple[typing.Type], None] = None,
|
|
278
|
+
**kwargs: typing.Any) -> None:
|
|
261
279
|
test_info = CLITestInfo.load_path(path, test_name, getattr(self, BASE_TEMP_DIR_ATTR), data_dir)
|
|
262
280
|
|
|
263
281
|
# Allow the test class a chance to modify the test info before the test runs.
|
|
@@ -281,6 +299,9 @@ def _get_test_method(test_name: str, path: str, data_dir: str) -> typing.Callabl
|
|
|
281
299
|
if (test_info.error):
|
|
282
300
|
self.fail(f"No error was not raised when one was expected ('{str(test_info.expected_stdout)}').")
|
|
283
301
|
except BaseException as ex:
|
|
302
|
+
if ((reraise_exception_types is not None) and isinstance(ex, reraise_exception_types)):
|
|
303
|
+
raise ex
|
|
304
|
+
|
|
284
305
|
if (not test_info.error):
|
|
285
306
|
raise ex
|
|
286
307
|
|
|
@@ -306,7 +327,8 @@ def _get_test_method(test_name: str, path: str, data_dir: str) -> typing.Callabl
|
|
|
306
327
|
|
|
307
328
|
return __method
|
|
308
329
|
|
|
309
|
-
def add_test_paths(target_class: type, data_dir: str, paths: typing.List[str]
|
|
330
|
+
def add_test_paths(target_class: type, data_dir: str, paths: typing.List[str],
|
|
331
|
+
test_method_wrapper: typing.Union[TestMethodWrapperFunction, None] = None) -> None:
|
|
310
332
|
""" Add tests from the given test files. """
|
|
311
333
|
|
|
312
334
|
# Attach a temp directory to the testing class so all tests can share a common base temp dir.
|
|
@@ -321,12 +343,18 @@ def add_test_paths(target_class: type, data_dir: str, paths: typing.List[str]) -
|
|
|
321
343
|
test_name = 'test_cli__' + basename
|
|
322
344
|
|
|
323
345
|
try:
|
|
324
|
-
|
|
346
|
+
test_method = _get_test_method(test_name, path, data_dir)
|
|
325
347
|
except Exception as ex:
|
|
326
348
|
raise ValueError(f"Failed to parse test case '{path}'.") from ex
|
|
327
349
|
|
|
328
|
-
|
|
350
|
+
if (test_method_wrapper is not None):
|
|
351
|
+
test_method = test_method_wrapper(test_method, path)
|
|
352
|
+
|
|
353
|
+
setattr(target_class, test_name, test_method)
|
|
354
|
+
|
|
355
|
+
def discover_test_cases(target_class: type, test_cases_dir: str, data_dir: str,
|
|
356
|
+
test_method_wrapper: typing.Union[TestMethodWrapperFunction, None] = None) -> None:
|
|
329
357
|
""" Look in the text cases directory for any test cases and add them as test methods to the test class. """
|
|
330
358
|
|
|
331
359
|
paths = list(sorted(glob.glob(os.path.join(test_cases_dir, "**", "*.txt"), recursive = True)))
|
|
332
|
-
add_test_paths(target_class, data_dir, paths)
|
|
360
|
+
add_test_paths(target_class, data_dir, paths, test_method_wrapper = test_method_wrapper)
|
|
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
|
|
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
|
{edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/data/configs/empty/edq-config.json
RENAMED
|
File without changes
|
{edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/data/configs/simple-1/edq-config.json
RENAMED
|
File without changes
|
{edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/data/configs/simple-2/edq-config.json
RENAMED
|
File without changes
|
|
File without changes
|
{edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/cli/tests/config/list/config_list_base.txt
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
|
{edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_anchor.httpex.json
RENAMED
|
File without changes
|
{edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_file.httpex.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_file_name.httpex.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_headers.httpex.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_params.httpex.json
RENAMED
|
File without changes
|
{edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_post.httpex.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{edq_utils-0.1.3 → edq_utils-0.1.4}/edq/testing/testdata/http/exchanges/simple_urlparams.httpex.json
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|