specmatic 1.3.25__py3-none-any.whl → 1.3.27__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 specmatic might be problematic. Click here for more details.

Binary file
@@ -15,5 +15,5 @@ class SanicAppRouteAdapter(AppRouteAdapter):
15
15
  return self.routes_as_list()
16
16
 
17
17
  def convert_to_spring_actuator_url_format(self, flask_route_url):
18
- pattern = r'<(\w+):(\w+)>'
19
- return re.sub(pattern, r'{\1}', flask_route_url)
18
+ pattern = r"<(\w+):([^\/]+)>"
19
+ return re.sub(pattern, r"{\1}", flask_route_url)
@@ -15,14 +15,14 @@ class PyTestGenerator(TestGeneratorBase):
15
15
 
16
16
  @staticmethod
17
17
  def _generate_passing_test():
18
- def test(self):
18
+ def test_pass(self):
19
19
  assert 1 == 1
20
20
 
21
- return test
21
+ return test_pass
22
22
 
23
23
  @staticmethod
24
24
  def _generate_failing_test(error):
25
- def test(self):
25
+ def test_fail(self):
26
26
  pytest.fail(error)
27
27
 
28
- return test
28
+ return test_fail
@@ -1,15 +1,29 @@
1
+ import re
1
2
  import xml.etree.ElementTree as ET
2
-
3
+ from typing import Callable, Type
3
4
 
4
5
  class TestGeneratorBase:
6
+ pattern = re.compile(r"[\s\S]*dynamic-test:#(\d+)[\s\S]*")
5
7
  @staticmethod
6
- def generate_tests(junit_report_path, test_class, passing_test_fn, failing_test_fn):
7
- root = ET.parse(junit_report_path).getroot()
8
- for testcase in root.iter('testcase'):
9
- scenario = testcase.find('system-out').text.split('display-name:')[1].strip()
10
- test_name = "test_" + scenario
11
- failure = testcase.find('failure')
12
- if failure is None:
13
- setattr(test_class, test_name, passing_test_fn())
14
- else:
15
- setattr(test_class, test_name, failing_test_fn(failure.get('message') + failure.text))
8
+ def generate_tests(junit_report_path: str, test_class: Type, passing_test_fn: Callable, failing_test_fn: Callable) -> None:
9
+ test_cases = []
10
+
11
+ try:
12
+ root = ET.parse(junit_report_path).getroot()
13
+ for testcase in root.iter('testcase'):
14
+ test_case_info = re.match(TestGeneratorBase.pattern, testcase.find('system-out').text) # type: ignore
15
+ if test_case_info is None:
16
+ raise ValueError("Invalid test case information")
17
+ unique_id = test_case_info.groups()[0]
18
+ test_name = f"test [{unique_id}] {testcase.get("name")}"
19
+ failure_message = testcase.findtext('failure')
20
+ if failure_message is None:
21
+ test_cases.append((unique_id, test_name, passing_test_fn()))
22
+ else:
23
+ test_cases.append((unique_id, test_name, failing_test_fn(failure_message)))
24
+ except ET.ParseError as e:
25
+ raise ValueError("Invalid XML file") from e
26
+
27
+ test_cases.sort(key=lambda testcase : int(testcase[0]))
28
+ for (unique_id, test_name, test_fn) in test_cases:
29
+ setattr(test_class, test_name, test_fn)
@@ -9,17 +9,17 @@ class UnitTestGenerator(TestGeneratorBase):
9
9
 
10
10
  @staticmethod
11
11
  def _gen_passing_test():
12
- def test(self):
12
+ def test_pass(self):
13
13
  self.assertTrue(1 == 1)
14
14
 
15
- return test
15
+ return test_pass
16
16
 
17
17
  @staticmethod
18
18
  def _gen_failing_test(error):
19
- def test(self):
19
+ def test_fail(self):
20
20
  self.fail(error)
21
21
 
22
- return test
22
+ return test_fail
23
23
 
24
24
  def generate(self):
25
25
  self.generate_tests(self.junit_report_path, self.test_class, UnitTestGenerator._gen_passing_test,
specmatic/version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = '1.3.25'
2
- __specmatic_version__ = '1.3.25'
1
+ __version__ = '1.3.27'
2
+ __specmatic_version__ = '1.3.27'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: specmatic
3
- Version: 1.3.25
3
+ Version: 1.3.27
4
4
  Summary: A Python module for using the Specmatic Library.
5
5
  Home-page: https://github.com/znsio/specmatic-python-extensions
6
6
  Author: Specmatic Builders
@@ -1,10 +1,10 @@
1
1
  specmatic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  specmatic/build_utils.py,sha256=ukvyMkk8kkUqZiR6zQrxZbafKMByiVLzASSbypMsDp4,564
3
3
  specmatic/utils.py,sha256=6JDPqpO51ykl0MWCOa32jkUOXZ-0RZ6N5Ng9_7r7XaU,519
4
- specmatic/version.py,sha256=1oKpRsL0S2arRQHDu3UlLukaOOaEzPRFcpC4DzwrEK0,56
4
+ specmatic/version.py,sha256=DlZsYGL9N8t47z2ROHeunepdc-rkvmTe4KyZrzT2BXE,56
5
5
  specmatic/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  specmatic/core/decorators.py,sha256=E2U8ewezMYz8TpOF44qtdL1ahPa5F_HXU0nZ9uSbS1Q,3944
7
- specmatic/core/specmatic.jar,sha256=a-qlx0MJXR5L5ql0RS_7mD5898MXRWzcsGrHwRGJTMU,66072988
7
+ specmatic/core/specmatic.jar,sha256=CpG542TxQV3a2oU-Jc0kj_YVx-9P5dg9UWFR0yE_HHc,65939832
8
8
  specmatic/core/specmatic.py,sha256=OkQy_rwhy9EQaUcB4L6Al_AtEDfwpTqwqZJccfpIKU4,7904
9
9
  specmatic/core/specmatic_base.py,sha256=NKFjJBB4edxinA8fgfd5aNOwJjD9xu7KpeeSsumoUTs,1735
10
10
  specmatic/core/specmatic_stub.py,sha256=_I6jc8oI7me6Q64gtPchRRqA-c8GGO5YTCIpw1nrwEo,4563
@@ -14,22 +14,22 @@ specmatic/coverage/app_route_adapter.py,sha256=hFJ54R7CZFK9jFI6VbxHtKJKJgLX4PUX4
14
14
  specmatic/coverage/coverage_route.py,sha256=WaqjG2Oh2PUfP72HoRnPkb5jG4BUmZK7Acla7gt_5Ko,284
15
15
  specmatic/coverage/fastapi_app_route_adapter.py,sha256=ziPbCCx6Mw2jxKis4Z9yd-jKNHmVKgAAVbIwFfAc3JA,869
16
16
  specmatic/coverage/flask_app_route_adapter.py,sha256=1OQXiqG3VCBwKpG5PGkjTHv27dnKjyy_spGhtg2omkE,897
17
- specmatic/coverage/sanic_app_route_adapter.py,sha256=LKt6YNE2CUYr7AqfjA8GS_uFGcniQ9C438BgDeFGuRs,758
17
+ specmatic/coverage/sanic_app_route_adapter.py,sha256=zvwvV_bpSigc86hmKnMXGYWMbuXFz2DxyfOHXkXff18,761
18
18
  specmatic/coverage/servers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  specmatic/coverage/servers/coverage_server.py,sha256=WaicRYG3LICiKmVg_TJlmuAS0espGLH9jWI6RsU6FPQ,2035
20
20
  specmatic/coverage/servers/fastapi_app_coverage_server.py,sha256=JwZcvDZrrwam6i875qMwWxIRI99Q0nXsXNEH2oNhCfk,283
21
21
  specmatic/coverage/servers/flask_app_coverage_server.py,sha256=JvswIhMaOXI7ab08Xd13T1x4p7vY2J9b2oe4MuJyC_k,275
22
22
  specmatic/coverage/servers/sanic_app_coverage_server.py,sha256=VoIxxGX8a2NPKJRkt6pfydxmw6TrV_r6lfAr94ekSdQ,275
23
23
  specmatic/generators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
- specmatic/generators/pytest_generator.py,sha256=x5p_k9wD0dNhV5kvIAM3_rvrQIE2ypCuJFTkyP3Q78Q,735
25
- specmatic/generators/test_generator_base.py,sha256=bCdJD9MOUX6FINPF2r06y9NQ5k10qN_38bfPXgWSfx4,668
26
- specmatic/generators/unittest_generator.py,sha256=Vkm8BP-_rZ-tFbLwUTNc90OgQCMJ4OHd8w5mShhcFyU,713
24
+ specmatic/generators/pytest_generator.py,sha256=jUvZ9BRJp_UFIphGT9PdgDRkzNd6bYmKMWlLZeB6d_Q,755
25
+ specmatic/generators/test_generator_base.py,sha256=X7pHFGVtUqweSrUqgE5EYX5pFMoJvOs3vxX-gVtykUo,1400
26
+ specmatic/generators/unittest_generator.py,sha256=jrWg_IIEcF7TA-D35XsTsdSbGpf6WUIlGoqHABQqNRw,733
27
27
  specmatic/servers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  specmatic/servers/app_server.py,sha256=kOZviJA7-F4kmMTLGiBln2oO5uYX28wKJM2xQJTOVQY,456
29
29
  specmatic/servers/asgi_app_server.py,sha256=yn3tpWoF-nP8labOJdn49UB85vKiqIELVXk-gAugcUc,2924
30
30
  specmatic/servers/wsgi_app_server.py,sha256=3aU-o6Hh8FrnZlbjCLLpGY92HvJoU_rcqsZIb9TKVr8,1342
31
31
  specmatic/servers/wsgi_server_thread.py,sha256=XUEYW7-FP1a-5EkQVGc3FI_jkDQBocArxHLiCn3JJvc,691
32
- specmatic-1.3.25.dist-info/METADATA,sha256=72zA4rzIceCtXsdR8eBe1RwH3-6kkA03khgVr5w8F5w,10355
33
- specmatic-1.3.25.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
34
- specmatic-1.3.25.dist-info/top_level.txt,sha256=E7kQ78YacKBoKKeKWR_N83exlG8r5J0wlzlGqFmvIfo,10
35
- specmatic-1.3.25.dist-info/RECORD,,
32
+ specmatic-1.3.27.dist-info/METADATA,sha256=sM0RRrVHU1Jk7mL6-JqJBF6zVFkFxb77vIGxk-VBhH0,10355
33
+ specmatic-1.3.27.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
34
+ specmatic-1.3.27.dist-info/top_level.txt,sha256=E7kQ78YacKBoKKeKWR_N83exlG8r5J0wlzlGqFmvIfo,10
35
+ specmatic-1.3.27.dist-info/RECORD,,