specmatic 1.3.25__tar.gz → 1.3.27__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.

Potentially problematic release.


This version of specmatic might be problematic. Click here for more details.

Files changed (43) hide show
  1. {specmatic-1.3.25/specmatic.egg-info → specmatic-1.3.27}/PKG-INFO +1 -1
  2. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/core/specmatic.jar +0 -0
  3. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/coverage/sanic_app_route_adapter.py +2 -2
  4. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/generators/pytest_generator.py +4 -4
  5. specmatic-1.3.27/specmatic/generators/test_generator_base.py +29 -0
  6. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/generators/unittest_generator.py +4 -4
  7. specmatic-1.3.27/specmatic/version.py +2 -0
  8. {specmatic-1.3.25 → specmatic-1.3.27/specmatic.egg-info}/PKG-INFO +1 -1
  9. specmatic-1.3.25/specmatic/generators/test_generator_base.py +0 -15
  10. specmatic-1.3.25/specmatic/version.py +0 -2
  11. {specmatic-1.3.25 → specmatic-1.3.27}/MANIFEST.in +0 -0
  12. {specmatic-1.3.25 → specmatic-1.3.27}/README.md +0 -0
  13. {specmatic-1.3.25 → specmatic-1.3.27}/setup.cfg +0 -0
  14. {specmatic-1.3.25 → specmatic-1.3.27}/setup.py +0 -0
  15. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/__init__.py +0 -0
  16. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/build_utils.py +0 -0
  17. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/core/__init__.py +0 -0
  18. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/core/decorators.py +0 -0
  19. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/core/specmatic.py +0 -0
  20. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/core/specmatic_base.py +0 -0
  21. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/core/specmatic_stub.py +0 -0
  22. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/core/specmatic_test.py +0 -0
  23. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/coverage/__init__.py +0 -0
  24. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/coverage/app_route_adapter.py +0 -0
  25. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/coverage/coverage_route.py +0 -0
  26. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/coverage/fastapi_app_route_adapter.py +0 -0
  27. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/coverage/flask_app_route_adapter.py +0 -0
  28. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/coverage/servers/__init__.py +0 -0
  29. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/coverage/servers/coverage_server.py +0 -0
  30. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/coverage/servers/fastapi_app_coverage_server.py +0 -0
  31. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/coverage/servers/flask_app_coverage_server.py +0 -0
  32. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/coverage/servers/sanic_app_coverage_server.py +0 -0
  33. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/generators/__init__.py +0 -0
  34. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/servers/__init__.py +0 -0
  35. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/servers/app_server.py +0 -0
  36. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/servers/asgi_app_server.py +0 -0
  37. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/servers/wsgi_app_server.py +0 -0
  38. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/servers/wsgi_server_thread.py +0 -0
  39. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic/utils.py +0 -0
  40. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic.egg-info/SOURCES.txt +0 -0
  41. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic.egg-info/dependency_links.txt +0 -0
  42. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic.egg-info/requires.txt +0 -0
  43. {specmatic-1.3.25 → specmatic-1.3.27}/specmatic.egg-info/top_level.txt +0 -0
@@ -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
@@ -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
@@ -0,0 +1,29 @@
1
+ import re
2
+ import xml.etree.ElementTree as ET
3
+ from typing import Callable, Type
4
+
5
+ class TestGeneratorBase:
6
+ pattern = re.compile(r"[\s\S]*dynamic-test:#(\d+)[\s\S]*")
7
+ @staticmethod
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,
@@ -0,0 +1,2 @@
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,15 +0,0 @@
1
- import xml.etree.ElementTree as ET
2
-
3
-
4
- class TestGeneratorBase:
5
- @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))
@@ -1,2 +0,0 @@
1
- __version__ = '1.3.25'
2
- __specmatic_version__ = '1.3.25'
File without changes
File without changes
File without changes
File without changes