edq-utils 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl
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.
Potentially problematic release.
This version of edq-utils might be problematic. Click here for more details.
- edq/__init__.py +1 -1
- edq/testing/cli.py +3 -2
- edq/testing/testdata/cli/tests/help_base.txt +9 -0
- edq/testing/unittest.py +14 -0
- edq/util/net.py +7 -2
- {edq_utils-0.1.0.dist-info → edq_utils-0.1.2.dist-info}/METADATA +7 -1
- {edq_utils-0.1.0.dist-info → edq_utils-0.1.2.dist-info}/RECORD +10 -9
- {edq_utils-0.1.0.dist-info → edq_utils-0.1.2.dist-info}/WHEEL +0 -0
- {edq_utils-0.1.0.dist-info → edq_utils-0.1.2.dist-info}/licenses/LICENSE +0 -0
- {edq_utils-0.1.0.dist-info → edq_utils-0.1.2.dist-info}/top_level.txt +0 -0
edq/__init__.py
CHANGED
edq/testing/cli.py
CHANGED
|
@@ -35,6 +35,7 @@ import edq.util.json
|
|
|
35
35
|
import edq.util.pyimport
|
|
36
36
|
|
|
37
37
|
TEST_CASE_SEP: str = '---'
|
|
38
|
+
OUTPUT_SEP: str = '+++'
|
|
38
39
|
DATA_DIR_ID: str = '__DATA_DIR__'
|
|
39
40
|
ABS_DATA_DIR_ID: str = '__ABS_DATA_DIR__'
|
|
40
41
|
TEMP_DIR_ID: str = '__TEMP_DIR__'
|
|
@@ -149,7 +150,7 @@ class CLITestInfo:
|
|
|
149
150
|
"""
|
|
150
151
|
Split stdout and stderr into different strings for testing.
|
|
151
152
|
By default, these two will be combined.
|
|
152
|
-
If both are non-empty, then they will be joined like: f"{stdout}\n{
|
|
153
|
+
If both are non-empty, then they will be joined like: f"{stdout}\n{OUTPUT_SEP}\n{stderr}".
|
|
153
154
|
Otherwise, only the non-empty one will be present with no separator.
|
|
154
155
|
Any stdout assertions will be applied to the combined text.
|
|
155
156
|
"""
|
|
@@ -293,7 +294,7 @@ def _get_test_method(test_name: str, path: str, data_dir: str) -> typing.Callabl
|
|
|
293
294
|
|
|
294
295
|
if (not test_info.split_stdout_stderr):
|
|
295
296
|
if ((len(stdout_text) > 0) and (len(stderr_text) > 0)):
|
|
296
|
-
stdout_text = f"{stdout_text}\n{
|
|
297
|
+
stdout_text = f"{stdout_text}\n{OUTPUT_SEP}\n{stderr_text}"
|
|
297
298
|
elif (len(stderr_text) > 0):
|
|
298
299
|
stdout_text = stderr_text
|
|
299
300
|
|
edq/testing/unittest.py
CHANGED
|
@@ -14,6 +14,20 @@ class BaseTest(unittest.TestCase):
|
|
|
14
14
|
maxDiff = None
|
|
15
15
|
""" Don't limit the size of diffs. """
|
|
16
16
|
|
|
17
|
+
def assertJSONEqual(self, a: typing.Any, b: typing.Any, message: typing.Union[str, None] = None) -> None: # pylint: disable=invalid-name
|
|
18
|
+
"""
|
|
19
|
+
Like unittest.TestCase.assertEqual(),
|
|
20
|
+
but uses a default assertion message containing the full JSON representation of the arguments.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
a_json = edq.util.json.dumps(a, indent = 4)
|
|
24
|
+
b_json = edq.util.json.dumps(b, indent = 4)
|
|
25
|
+
|
|
26
|
+
if (message is None):
|
|
27
|
+
message = FORMAT_STR % (a_json, b_json)
|
|
28
|
+
|
|
29
|
+
super().assertEqual(a, b, msg = message)
|
|
30
|
+
|
|
17
31
|
def assertJSONDictEqual(self, a: typing.Any, b: typing.Any, message: typing.Union[str, None] = None) -> None: # pylint: disable=invalid-name
|
|
18
32
|
"""
|
|
19
33
|
Like unittest.TestCase.assertDictEqual(),
|
edq/util/net.py
CHANGED
|
@@ -666,6 +666,7 @@ def make_request(method: str, url: str,
|
|
|
666
666
|
params_to_skip: typing.Union[typing.List[str], None] = None,
|
|
667
667
|
http_exchange_extension: str = DEFAULT_HTTP_EXCHANGE_EXTENSION,
|
|
668
668
|
add_http_prefix: bool = True,
|
|
669
|
+
additional_requests_options: typing.Union[typing.Dict[str, typing.Any], None] = None,
|
|
669
670
|
**kwargs: typing.Any) -> typing.Tuple[requests.Response, str]:
|
|
670
671
|
"""
|
|
671
672
|
Make an HTTP request and return the response object and text body.
|
|
@@ -686,6 +687,9 @@ def make_request(method: str, url: str,
|
|
|
686
687
|
if (files is None):
|
|
687
688
|
files = []
|
|
688
689
|
|
|
690
|
+
if (additional_requests_options is None):
|
|
691
|
+
additional_requests_options = {}
|
|
692
|
+
|
|
689
693
|
# Add in the anchor as a header (since it is not traditionally sent in an HTTP request).
|
|
690
694
|
if (send_anchor_header):
|
|
691
695
|
headers = headers.copy()
|
|
@@ -693,11 +697,12 @@ def make_request(method: str, url: str,
|
|
|
693
697
|
parts = urllib.parse.urlparse(url)
|
|
694
698
|
headers[ANCHOR_HEADER_KEY] = parts.fragment.lstrip('#')
|
|
695
699
|
|
|
696
|
-
options =
|
|
700
|
+
options = additional_requests_options.copy()
|
|
701
|
+
options.update({
|
|
697
702
|
'headers': headers,
|
|
698
703
|
'files': files,
|
|
699
704
|
'timeout': timeout_secs,
|
|
700
|
-
}
|
|
705
|
+
})
|
|
701
706
|
|
|
702
707
|
if (method == 'GET'):
|
|
703
708
|
options['params'] = data
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: edq-utils
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Common utilities used by EduLinq Python projects.
|
|
5
5
|
Author-email: Eriq Augustine <eriq@edulinq.org>
|
|
6
6
|
License: MIT License
|
|
@@ -50,6 +50,12 @@ Dynamic: license-file
|
|
|
50
50
|
|
|
51
51
|
Common utilities used by EduLinq Python projects.
|
|
52
52
|
|
|
53
|
+
Links:
|
|
54
|
+
- [API Reference](https://edulinq.github.io/python-utils)
|
|
55
|
+
- [Installation / Requirements](#installation--requirements)
|
|
56
|
+
- [Configuration System](#configuration-system)
|
|
57
|
+
- [Configuration Sources](#configuration-sources)
|
|
58
|
+
|
|
53
59
|
## Installation / Requirements
|
|
54
60
|
|
|
55
61
|
This project requires [Python](https://www.python.org/) >= 3.8.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
edq/__init__.py,sha256=
|
|
1
|
+
edq/__init__.py,sha256=VAgZ9kvZ2qpXBYL-SEmjPCrwVnAvgGTObRn8sfZjbvw,86
|
|
2
2
|
edq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
edq/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
edq/cli/version.py,sha256=SxarRVD_AVA-nD4pLVMe6ZjSJpMr7h_r3DgYYs42vjE,591
|
|
@@ -21,16 +21,17 @@ edq/procedure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
21
21
|
edq/procedure/verify_exchanges.py,sha256=Bv-wscTaSx5bbQfD6tZutCtG_pyHuFIBhk_RB5ZMJEQ,2765
|
|
22
22
|
edq/testing/__init__.py,sha256=IKd3fPU_8d_jP19HxG-zKwxFwn7nqFGGtXOY5slY41c,32
|
|
23
23
|
edq/testing/asserts.py,sha256=BxWTH9aQFwmzb0tf5hx3V4aeJzmiBOO-QajaMM6zklI,2523
|
|
24
|
-
edq/testing/cli.py,sha256=
|
|
24
|
+
edq/testing/cli.py,sha256=Pzb1-6nrC6kYRBTI4R-pCfwDQ7reQUzH68xLn2ZSdME,12916
|
|
25
25
|
edq/testing/cli_test.py,sha256=IqzdK1fEit_3HagSU-nNI4EjkoQp6-I88JGZ1_x_uQk,525
|
|
26
26
|
edq/testing/httpserver.py,sha256=r2xSFkHTEzO92vW9XV5g43kC3vOcyQD-RVedXke1IZI,20311
|
|
27
27
|
edq/testing/httpserver_test.py,sha256=tjBgBbKTHeqE1ugHyao4HpW7FNPTkBGpWK3vuqJgNQg,12123
|
|
28
28
|
edq/testing/run.py,sha256=Axv0t6yZRUS39xmf5PWR5b54Rg21Nz0ip8G4UyJm1Ik,4814
|
|
29
|
-
edq/testing/unittest.py,sha256=
|
|
29
|
+
edq/testing/unittest.py,sha256=7-5ScxXpMBvhhyCvRMPiiUbdfx9FcpMgU6M5A3oHV7c,2980
|
|
30
30
|
edq/testing/testdata/cli/data/configs/empty/edq-config.json,sha256=yj0WO6sFU4GCciYUBWjzvvfqrBh869doeOC2Pp5EI1Y,3
|
|
31
31
|
edq/testing/testdata/cli/data/configs/simple-1/edq-config.json,sha256=uQdt7o7VNjOSQk8ni6UrqZ95QkJTUgHcwaL2TvY30bs,42
|
|
32
32
|
edq/testing/testdata/cli/data/configs/simple-2/edq-config.json,sha256=F3vP5hF1G7rPp2PPUgHemvgA-2AuxTC6Pah8Yr-fRmw,37
|
|
33
33
|
edq/testing/testdata/cli/data/configs/value-number/edq-config.json,sha256=UrB_6Pa_JRZN3NzuM0OugxQgPizUC5RMqP5xv06cuvg,20
|
|
34
|
+
edq/testing/testdata/cli/tests/help_base.txt,sha256=7FWdcKFpICb8lfz-Zj_b8izzGK5ri0FqH0FJrTn5jss,122
|
|
34
35
|
edq/testing/testdata/cli/tests/platform_skip.txt,sha256=J6n7v3LhfTyjR3Ejo-uR-g6Xdxx34Fu_cmyGSii_elc,103
|
|
35
36
|
edq/testing/testdata/cli/tests/version_base.txt,sha256=5e9oSQaivA-0Th7wXpNRhACluyDwvFTL_1xfAkS2Pko,69
|
|
36
37
|
edq/testing/testdata/cli/tests/config/list/config_list_base.txt,sha256=jtHqRPxM-uJfMkmnZaSDilsxMF7y6UXw-iEtHe8XCuw,495
|
|
@@ -65,14 +66,14 @@ edq/util/dirent.py,sha256=gvU7I8TPFIjURAOPalfaOf3GSlAA0mXET_bHKC6_e_A,10369
|
|
|
65
66
|
edq/util/dirent_test.py,sha256=WUx6Ux-13L9YIg2rDyOROv5Kbvgr4xy693ceG1osAP0,33855
|
|
66
67
|
edq/util/json.py,sha256=nl_cxrlP97RX1BFtys8IT_3IfO0-XvBDQBe6YdrblB4,5936
|
|
67
68
|
edq/util/json_test.py,sha256=utUVRbw3z42ke4fpRVI294RrFHcMKms8khVYRkISNk4,8009
|
|
68
|
-
edq/util/net.py,sha256=
|
|
69
|
+
edq/util/net.py,sha256=KJZph2rj7YzALT46xIx6QBu_7nSyimJsRA2ZvxpM134,33101
|
|
69
70
|
edq/util/pyimport.py,sha256=26OIuCXELyqtwlooMqDEs4GJQrkrAgxnXNYTlqqtsBY,2852
|
|
70
71
|
edq/util/pyimport_test.py,sha256=Xno0MIa3yMTfBfoTgjKCIMpr1ZShU6bvo9rBRdecXQU,4202
|
|
71
72
|
edq/util/reflection.py,sha256=jPcW6h0fwSDYh04O5rUxlgoF7HK6fVQ2mq7DD9qPrEg,972
|
|
72
73
|
edq/util/time.py,sha256=anoNM_KniARLombv2BnsoHuCzDqMKiDdIzV7RUe2ZOk,2648
|
|
73
74
|
edq/util/time_test.py,sha256=iQZwzVTVQQ4TdXrLb9MUMCYlKrIe8qyF-hiC9YLTaMo,4610
|
|
74
|
-
edq_utils-0.1.
|
|
75
|
-
edq_utils-0.1.
|
|
76
|
-
edq_utils-0.1.
|
|
77
|
-
edq_utils-0.1.
|
|
78
|
-
edq_utils-0.1.
|
|
75
|
+
edq_utils-0.1.2.dist-info/licenses/LICENSE,sha256=MS4iYEl4rOxMoprZuc86iYVoyk4YgaVoMt7WmGvVF8w,1064
|
|
76
|
+
edq_utils-0.1.2.dist-info/METADATA,sha256=D8tZ8ZU7TXBQ6FEmam6zvCerJlc9Gsoj-_4pANJGRlc,7535
|
|
77
|
+
edq_utils-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
78
|
+
edq_utils-0.1.2.dist-info/top_level.txt,sha256=znBHSj6tgXtcMKrUVtovLli5fIEJCb7d-BMxTLRK4zk,4
|
|
79
|
+
edq_utils-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|