specmatic 2.3.0__tar.gz → 2.4.0__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 (42) hide show
  1. {specmatic-2.3.0/specmatic.egg-info → specmatic-2.4.0}/PKG-INFO +1 -1
  2. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/core/specmatic.jar +0 -0
  3. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/core/specmatic_stub.py +16 -7
  4. specmatic-2.4.0/specmatic/version.py +2 -0
  5. {specmatic-2.3.0 → specmatic-2.4.0/specmatic.egg-info}/PKG-INFO +1 -1
  6. specmatic-2.3.0/specmatic/version.py +0 -2
  7. {specmatic-2.3.0 → specmatic-2.4.0}/MANIFEST.in +0 -0
  8. {specmatic-2.3.0 → specmatic-2.4.0}/README.md +0 -0
  9. {specmatic-2.3.0 → specmatic-2.4.0}/setup.cfg +0 -0
  10. {specmatic-2.3.0 → specmatic-2.4.0}/setup.py +0 -0
  11. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/__init__.py +0 -0
  12. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/build_utils.py +0 -0
  13. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/core/__init__.py +0 -0
  14. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/core/decorators.py +0 -0
  15. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/core/specmatic.py +0 -0
  16. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/core/specmatic_base.py +0 -0
  17. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/core/specmatic_test.py +0 -0
  18. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/coverage/__init__.py +0 -0
  19. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/coverage/app_route_adapter.py +0 -0
  20. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/coverage/coverage_route.py +0 -0
  21. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/coverage/fastapi_app_route_adapter.py +0 -0
  22. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/coverage/flask_app_route_adapter.py +0 -0
  23. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/coverage/sanic_app_route_adapter.py +0 -0
  24. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/coverage/servers/__init__.py +0 -0
  25. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/coverage/servers/coverage_server.py +0 -0
  26. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/coverage/servers/fastapi_app_coverage_server.py +0 -0
  27. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/coverage/servers/flask_app_coverage_server.py +0 -0
  28. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/coverage/servers/sanic_app_coverage_server.py +0 -0
  29. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/generators/__init__.py +0 -0
  30. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/generators/pytest_generator.py +0 -0
  31. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/generators/test_generator_base.py +0 -0
  32. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/generators/unittest_generator.py +0 -0
  33. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/servers/__init__.py +0 -0
  34. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/servers/app_server.py +0 -0
  35. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/servers/asgi_app_server.py +0 -0
  36. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/servers/wsgi_app_server.py +0 -0
  37. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/servers/wsgi_server_thread.py +0 -0
  38. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic/utils.py +0 -0
  39. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic.egg-info/SOURCES.txt +0 -0
  40. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic.egg-info/dependency_links.txt +0 -0
  41. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic.egg-info/requires.txt +0 -0
  42. {specmatic-2.3.0 → specmatic-2.4.0}/specmatic.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: specmatic
3
- Version: 2.3.0
3
+ Version: 2.4.0
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
@@ -17,7 +17,8 @@ class SpecmaticStub(SpecmaticBase):
17
17
  super().__init__(host, port, project_root, specmatic_config_file_path, args)
18
18
  self.__stub_started_event = None
19
19
  self.__process = None
20
- self.__stub_running_success_message = 'Stub server is running on '
20
+ self.__free_port_message = 'Free port found'
21
+ self.__stub_serving_message = 'serving endpoints from specs'
21
22
  self.__error_queue = Queue()
22
23
  self.__start()
23
24
 
@@ -38,9 +39,14 @@ class SpecmaticStub(SpecmaticBase):
38
39
  print(f"\n Shutting down specmatic stub server on {self.host}:{self.port}, please wait ...")
39
40
  self.__process.kill()
40
41
 
41
- def set_expectations(self, file_paths: []):
42
+ def set_expectations(self, file_paths: list[str], port: int|None = None):
43
+ port = port or self.port
44
+ if port is None:
45
+ raise Exception("The port needs to be specified, as the stub started on a random port and extraction failed from logs")
46
+
42
47
  if file_paths is None:
43
48
  file_paths = []
49
+
44
50
  try:
45
51
  for file_path in file_paths:
46
52
  with open(file_path, 'r') as file:
@@ -48,7 +54,7 @@ class SpecmaticStub(SpecmaticBase):
48
54
  headers = {
49
55
  "Content-Type": "application/json"
50
56
  }
51
- response = requests.post(self.__get_expectations_api_url(), json=json_string, headers=headers)
57
+ response = requests.post(self.__get_expectations_api_url(port), json=json_string, headers=headers)
52
58
  if response.status_code != 200:
53
59
  self.stop()
54
60
  raise Exception(f"{response.content} received for expectation json file: {json_string}")
@@ -58,8 +64,8 @@ class SpecmaticStub(SpecmaticBase):
58
64
  print(f"Error: {e}")
59
65
  raise e
60
66
 
61
- def __get_expectations_api_url(self):
62
- return f'http://{self.host}:{self.port}/_specmatic/expectations'
67
+ def __get_expectations_api_url(self, port):
68
+ return f'http://{self.host}:{port}/_specmatic/expectations'
63
69
 
64
70
  def __start_specmatic_stub_in_subprocess(self):
65
71
  stub_command = self.__create_stub_process_command()
@@ -83,9 +89,12 @@ class SpecmaticStub(SpecmaticBase):
83
89
 
84
90
  def __read_process_output(self):
85
91
  def signal_event_if_stub_has_started(line):
86
- if self.__stub_running_success_message in line:
92
+ if self.__free_port_message in line and self.port == 0:
93
+ self.port = line.split(self.__free_port_message + ":")[1].strip()
94
+
95
+ if self.__stub_serving_message in line:
87
96
  if self.port == 0:
88
- self.port = line.split(self.host + ':')[1].split('.')[0]
97
+ self.port = line.split(self.__stub_serving_message)[0].split(":")[-1].strip()
89
98
  self.__stub_started_event.set()
90
99
 
91
100
  def read_and_print_output_line_by_line():
@@ -0,0 +1,2 @@
1
+ __version__ = '2.4.0'
2
+ __specmatic_version__ = '2.4.0'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: specmatic
3
- Version: 2.3.0
3
+ Version: 2.4.0
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,2 +0,0 @@
1
- __version__ = '2.3.0'
2
- __specmatic_version__ = '2.3.0'
File without changes
File without changes
File without changes
File without changes
File without changes