specmatic 2.2.1__py3-none-any.whl → 2.4.0__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.
- specmatic/core/specmatic.jar +0 -0
- specmatic/core/specmatic_stub.py +16 -7
- specmatic/version.py +2 -2
- {specmatic-2.2.1.dist-info → specmatic-2.4.0.dist-info}/METADATA +1 -1
- {specmatic-2.2.1.dist-info → specmatic-2.4.0.dist-info}/RECORD +7 -7
- {specmatic-2.2.1.dist-info → specmatic-2.4.0.dist-info}/WHEEL +0 -0
- {specmatic-2.2.1.dist-info → specmatic-2.4.0.dist-info}/top_level.txt +0 -0
specmatic/core/specmatic.jar
CHANGED
|
Binary file
|
specmatic/core/specmatic_stub.py
CHANGED
|
@@ -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.
|
|
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}:{
|
|
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.
|
|
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.
|
|
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():
|
specmatic/version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = '2.
|
|
2
|
-
__specmatic_version__ = '2.
|
|
1
|
+
__version__ = '2.4.0'
|
|
2
|
+
__specmatic_version__ = '2.4.0'
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
specmatic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
specmatic/build_utils.py,sha256=vIOoNyEUYofdMo3-U5bB9obL0lvjw4dEEGbZJNIzsL0,564
|
|
3
3
|
specmatic/utils.py,sha256=6JDPqpO51ykl0MWCOa32jkUOXZ-0RZ6N5Ng9_7r7XaU,519
|
|
4
|
-
specmatic/version.py,sha256=
|
|
4
|
+
specmatic/version.py,sha256=kC06Pa1bxyfu0z0ZNpu3OCT9G8dd1XrL4vPRW3JJbbk,54
|
|
5
5
|
specmatic/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
specmatic/core/decorators.py,sha256=jGi_m2tGGn8HZOyiMvAB3GvOWW_AkuWZvfqztMVy2pc,3972
|
|
7
|
-
specmatic/core/specmatic.jar,sha256=
|
|
7
|
+
specmatic/core/specmatic.jar,sha256=EE7K_kTmikEbEYe3AlR1vcBjZZZbIIOsCnMQvApYiV8,74490852
|
|
8
8
|
specmatic/core/specmatic.py,sha256=vi7-LM5XTKipWwemh5cnbIoAZDbg9fpFEISDs6YM_f4,7918
|
|
9
9
|
specmatic/core/specmatic_base.py,sha256=IN9LY45EB5ApRtpF-LEkLmmy20gAXXAMwYhJQrS8TT0,1334
|
|
10
|
-
specmatic/core/specmatic_stub.py,sha256=
|
|
10
|
+
specmatic/core/specmatic_stub.py,sha256=XEzA9_MsLLgjvqA5MDN78BMUGAAbMi4RSgkzm4bxO-o,4964
|
|
11
11
|
specmatic/core/specmatic_test.py,sha256=cXU5882L5wPUiscWwm1HDR_knBJjOCNssODcUrKBHdI,1048
|
|
12
12
|
specmatic/coverage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
specmatic/coverage/app_route_adapter.py,sha256=hFJ54R7CZFK9jFI6VbxHtKJKJgLX4PUX47TMdWjjhSA,1538
|
|
@@ -29,7 +29,7 @@ specmatic/servers/app_server.py,sha256=kOZviJA7-F4kmMTLGiBln2oO5uYX28wKJM2xQJTOV
|
|
|
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-2.
|
|
33
|
-
specmatic-2.
|
|
34
|
-
specmatic-2.
|
|
35
|
-
specmatic-2.
|
|
32
|
+
specmatic-2.4.0.dist-info/METADATA,sha256=DCuF0NXokf6hLLr26NlrySzPETrHACN75jsOa4sHGss,10356
|
|
33
|
+
specmatic-2.4.0.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
34
|
+
specmatic-2.4.0.dist-info/top_level.txt,sha256=E7kQ78YacKBoKKeKWR_N83exlG8r5J0wlzlGqFmvIfo,10
|
|
35
|
+
specmatic-2.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|