specmatic 2.0.0__tar.gz → 2.0.1__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.0.0/specmatic.egg-info → specmatic-2.0.1}/PKG-INFO +6 -6
  2. {specmatic-2.0.0 → specmatic-2.0.1}/README.md +5 -5
  3. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/core/decorators.py +4 -4
  4. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/core/specmatic.jar +0 -0
  5. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/core/specmatic.py +5 -5
  6. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/core/specmatic_base.py +5 -13
  7. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/core/specmatic_stub.py +2 -3
  8. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/core/specmatic_test.py +2 -3
  9. specmatic-2.0.1/specmatic/version.py +2 -0
  10. {specmatic-2.0.0 → specmatic-2.0.1/specmatic.egg-info}/PKG-INFO +6 -6
  11. specmatic-2.0.0/specmatic/version.py +0 -2
  12. {specmatic-2.0.0 → specmatic-2.0.1}/MANIFEST.in +0 -0
  13. {specmatic-2.0.0 → specmatic-2.0.1}/setup.cfg +0 -0
  14. {specmatic-2.0.0 → specmatic-2.0.1}/setup.py +0 -0
  15. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/__init__.py +0 -0
  16. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/build_utils.py +0 -0
  17. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/core/__init__.py +0 -0
  18. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/coverage/__init__.py +0 -0
  19. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/coverage/app_route_adapter.py +0 -0
  20. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/coverage/coverage_route.py +0 -0
  21. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/coverage/fastapi_app_route_adapter.py +0 -0
  22. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/coverage/flask_app_route_adapter.py +0 -0
  23. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/coverage/sanic_app_route_adapter.py +0 -0
  24. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/coverage/servers/__init__.py +0 -0
  25. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/coverage/servers/coverage_server.py +0 -0
  26. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/coverage/servers/fastapi_app_coverage_server.py +0 -0
  27. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/coverage/servers/flask_app_coverage_server.py +0 -0
  28. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/coverage/servers/sanic_app_coverage_server.py +0 -0
  29. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/generators/__init__.py +0 -0
  30. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/generators/pytest_generator.py +0 -0
  31. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/generators/test_generator_base.py +0 -0
  32. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/generators/unittest_generator.py +0 -0
  33. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/servers/__init__.py +0 -0
  34. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/servers/app_server.py +0 -0
  35. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/servers/asgi_app_server.py +0 -0
  36. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/servers/wsgi_app_server.py +0 -0
  37. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/servers/wsgi_server_thread.py +0 -0
  38. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic/utils.py +0 -0
  39. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic.egg-info/SOURCES.txt +0 -0
  40. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic.egg-info/dependency_links.txt +0 -0
  41. {specmatic-2.0.0 → specmatic-2.0.1}/specmatic.egg-info/requires.txt +0 -0
  42. {specmatic-2.0.0 → specmatic-2.0.1}/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.0.0
3
+ Version: 2.0.1
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,7 +15,7 @@ Requires-Dist: flask>=2.2.5
15
15
  Requires-Dist: sanic>=22.12.0
16
16
 
17
17
  # Specmatic Python
18
- This is a Python library to run [Specmatic](https://specmatic.in).
18
+ This is a Python library to run [Specmatic](https://specmatic.io).
19
19
  Specmatic is a contract driven development tool that allows us to turn OpenAPI contracts into executable specifications.
20
20
  <br/>Click below to learn more about Specmatic and Contract Driven Development<br/><br/>
21
21
  [![Specmatic - Contract Driven Development](https://img.youtube.com/vi/3HPgpvd8MGg/0.jpg)](https://www.youtube.com/watch?v=3HPgpvd8MGg "Specmatic - Contract Driven Development")
@@ -27,8 +27,8 @@ Specmatic is a contract driven development tool that allows us to turn OpenAPI c
27
27
 
28
28
  #### Running Contract Tests
29
29
  A contract test validates an open api specification against a running api service.
30
- The open api specification can be present either locally or in a [Central Contract Repository](https://specmatic.in/documentation/central_contract_repository.html)
31
- [Click here](https://specmatic.in/documentation/contract_tests.html) to learn more about contract tests.
30
+ The open api specification can be present either locally or in a [Central Contract Repository](https://specmatic.io/documentation/central_contract_repository.html)
31
+ [Click here](https://specmatic.io/documentation/contract_tests.html) to learn more about contract tests.
32
32
 
33
33
  #### How to use
34
34
  - Create a file called test_contract.py in your test folder.
@@ -82,12 +82,12 @@ pytest.main()
82
82
  - In this, we are passing:
83
83
  - an instance of your wsgi app like flask
84
84
  - app_host and app_port. If they are not specified, the app will be started on a random available port on 127.0.0.1.
85
- - You would need a [specmatic.json](https://specmatic.in/documentation/specmatic_json.html) file to be present in the root directory of your project.
85
+ - You would need a [specmatic config](https://specmatic.in/documentation/specmatic_json.html) file to be present in the root directory of your project.
86
86
  - an empty test class.
87
87
  - stub_host, stub_port, optional list of json files to set expectations on the stub.
88
88
  The stub_host, stub_port will be used to run the specmatic stub server.
89
89
  If they are not supplied, the stub will be started on a random available port on 127.0.0.1.
90
- [Click here](https://specmatic.in/documentation/service_virtualization_tutorial.html) to learn more about stubbing/service virtualization.
90
+ [Click here](https://specmatic.io/documentation/service_virtualization_tutorial.html) to learn more about stubbing/service virtualization.
91
91
  - You can run this test from either your IDE or command line by pointing pytest to your test folder:
92
92
  ``````pytest test -v -s``````
93
93
  - NOTE: Please ensure that you set the '-v' and '-s' flags while running pytest as otherwise pytest may swallow up the console output.
@@ -1,5 +1,5 @@
1
1
  # Specmatic Python
2
- This is a Python library to run [Specmatic](https://specmatic.in).
2
+ This is a Python library to run [Specmatic](https://specmatic.io).
3
3
  Specmatic is a contract driven development tool that allows us to turn OpenAPI contracts into executable specifications.
4
4
  <br/>Click below to learn more about Specmatic and Contract Driven Development<br/><br/>
5
5
  [![Specmatic - Contract Driven Development](https://img.youtube.com/vi/3HPgpvd8MGg/0.jpg)](https://www.youtube.com/watch?v=3HPgpvd8MGg "Specmatic - Contract Driven Development")
@@ -11,8 +11,8 @@ Specmatic is a contract driven development tool that allows us to turn OpenAPI c
11
11
 
12
12
  #### Running Contract Tests
13
13
  A contract test validates an open api specification against a running api service.
14
- The open api specification can be present either locally or in a [Central Contract Repository](https://specmatic.in/documentation/central_contract_repository.html)
15
- [Click here](https://specmatic.in/documentation/contract_tests.html) to learn more about contract tests.
14
+ The open api specification can be present either locally or in a [Central Contract Repository](https://specmatic.io/documentation/central_contract_repository.html)
15
+ [Click here](https://specmatic.io/documentation/contract_tests.html) to learn more about contract tests.
16
16
 
17
17
  #### How to use
18
18
  - Create a file called test_contract.py in your test folder.
@@ -66,12 +66,12 @@ pytest.main()
66
66
  - In this, we are passing:
67
67
  - an instance of your wsgi app like flask
68
68
  - app_host and app_port. If they are not specified, the app will be started on a random available port on 127.0.0.1.
69
- - You would need a [specmatic.json](https://specmatic.in/documentation/specmatic_json.html) file to be present in the root directory of your project.
69
+ - You would need a [specmatic config](https://specmatic.in/documentation/specmatic_json.html) file to be present in the root directory of your project.
70
70
  - an empty test class.
71
71
  - stub_host, stub_port, optional list of json files to set expectations on the stub.
72
72
  The stub_host, stub_port will be used to run the specmatic stub server.
73
73
  If they are not supplied, the stub will be started on a random available port on 127.0.0.1.
74
- [Click here](https://specmatic.in/documentation/service_virtualization_tutorial.html) to learn more about stubbing/service virtualization.
74
+ [Click here](https://specmatic.io/documentation/service_virtualization_tutorial.html) to learn more about stubbing/service virtualization.
75
75
  - You can run this test from either your IDE or command line by pointing pytest to your test folder:
76
76
  ``````pytest test -v -s``````
77
77
  - NOTE: Please ensure that you set the '-v' and '-s' flags while running pytest as otherwise pytest may swallow up the console output.
@@ -12,10 +12,10 @@ from specmatic.utils import get_junit_report_file_path
12
12
 
13
13
 
14
14
  def specmatic_stub(host: str = '127.0.0.1', port: int = 0, project_root: str = '', expectations=None,
15
- specmatic_json_file: str = ''):
15
+ specmatic_config_file_path: str = ''):
16
16
  def decorator(cls):
17
17
  try:
18
- cls.stub = SpecmaticStub(host, port, project_root, specmatic_json_file)
18
+ cls.stub = SpecmaticStub(host, port, project_root, specmatic_config_file_path)
19
19
  cls.stub.set_expectations(expectations)
20
20
  except Exception as e:
21
21
  if hasattr(cls, 'stub'):
@@ -31,7 +31,7 @@ def specmatic_stub(host: str = '127.0.0.1', port: int = 0, project_root: str = '
31
31
 
32
32
  def specmatic_contract_test(host: str = '127.0.0,1', port: int = 0,
33
33
  project_root: str = '',
34
- specmatic_json_file: str = '', args=None, appRouteAdapter: AppRouteAdapter=None,):
34
+ specmatic_config_file_path: str = '', args=None, appRouteAdapter: AppRouteAdapter=None,):
35
35
  def decorator(cls):
36
36
  try:
37
37
  test_host = host
@@ -47,7 +47,7 @@ def specmatic_contract_test(host: str = '127.0.0,1', port: int = 0,
47
47
  cls.coverage_server.start()
48
48
  endpoints_api = cls.coverage_server.endpoints_api
49
49
 
50
- SpecmaticTest(test_host, test_port, project_root, specmatic_json_file, args,
50
+ SpecmaticTest(test_host, test_port, project_root, specmatic_config_file_path, args,
51
51
  endpoints_api).run()
52
52
 
53
53
  if issubclass(cls, unittest.TestCase):
@@ -37,7 +37,7 @@ class Specmatic:
37
37
  self.test_args = None
38
38
 
39
39
  self.project_root = ''
40
- self.specmatic_json_file_path = ''
40
+ self.specmatic_config_file_path = ''
41
41
 
42
42
  self.run_stub = False
43
43
  self.run_app = False
@@ -50,8 +50,8 @@ class Specmatic:
50
50
  self.project_root = project_root
51
51
  return self
52
52
 
53
- def with_specmatic_json_file_path(self, specmatic_json_file_path):
54
- self.specmatic_json_file_path = specmatic_json_file_path
53
+ def with_specmatic_config_file_path(self, specmatic_config_file_path):
54
+ self.specmatic_config_file_path = specmatic_config_file_path
55
55
  return self
56
56
 
57
57
  def with_stub(self, stub_host: str = '127.0.0.1', stub_port: int = 0, expectations=None, args=None):
@@ -138,7 +138,7 @@ class Specmatic:
138
138
 
139
139
  def __start_stub(self):
140
140
  if self.run_stub:
141
- self.stub = SpecmaticStub(self.stub_host, self.stub_port, self.project_root, self.specmatic_json_file_path,
141
+ self.stub = SpecmaticStub(self.stub_host, self.stub_port, self.project_root, self.specmatic_config_file_path,
142
142
  self.stub_args)
143
143
  self.stub.set_expectations(self.expectations)
144
144
  if self.app_server is not None:
@@ -157,7 +157,7 @@ class Specmatic:
157
157
  self.endpoints_api = self.coverage_server.endpoints_api
158
158
 
159
159
  SpecmaticTest(self.test_host, self.test_port, self.project_root,
160
- self.specmatic_json_file_path, self.test_args, self.endpoints_api).run()
160
+ self.specmatic_config_file_path, self.test_args, self.endpoints_api).run()
161
161
 
162
162
  if issubclass(self.test_class, unittest.TestCase):
163
163
  print("Injecting unittest methods")
@@ -3,22 +3,15 @@ import os
3
3
 
4
4
  class SpecmaticBase:
5
5
  def __init__(self, host: str = '127.0.0.1', port: int = 0, project_root: str = '',
6
- specmatic_json_file_path: str = '', args=None, endpoints_api=""):
7
- self.specmatic_json_file_path = None
6
+ specmatic_config_file_path: str = '', args=None, endpoints_api=""):
8
7
  self.contract_file_paths = None
9
- self.project_root = None
10
8
  self.project_root = project_root
11
9
  self.host = host
12
10
  self.port = port
13
- self.specmatic_json_file_path = specmatic_json_file_path
11
+ self.specmatic_config_file_path = specmatic_config_file_path
14
12
  self.args = [] if args is None else args
15
13
  self.endpoints_api = endpoints_api
16
14
 
17
- def validate_mandatory_fields(self):
18
- if self.project_root == '' and self.specmatic_json_file_path == '':
19
- raise Exception(
20
- 'Please specify either of the following parameters: project_root, specmatic_json_file_path')
21
-
22
15
  def create_command_array(self, mode: str, junit_dir_path=""):
23
16
  jar_path = os.path.dirname(os.path.realpath(__file__)) + "/specmatic.jar"
24
17
  cmd = ["java"]
@@ -31,10 +24,9 @@ class SpecmaticBase:
31
24
  cmd.append(jar_path)
32
25
  cmd.append(mode)
33
26
 
34
- if self.specmatic_json_file_path != '':
35
- cmd.append("--config=" + self.specmatic_json_file_path)
36
- else:
37
- cmd.append("--config=" + self.project_root + "/specmatic.json")
27
+ if self.specmatic_config_file_path != '':
28
+ cmd.append("--config=" + self.specmatic_config_file_path)
29
+
38
30
  cmd += ['--host=' + self.host]
39
31
  if self.port != 0:
40
32
  cmd += ["--port=" + str(self.port)]
@@ -13,8 +13,8 @@ from specmatic.core.specmatic_base import SpecmaticBase
13
13
  class SpecmaticStub(SpecmaticBase):
14
14
 
15
15
  def __init__(self, host: str = '127.0.0.1', port: int = 0, project_root: str = '',
16
- specmatic_json_file_path: str = '', args=None):
17
- super().__init__(host, port, project_root, specmatic_json_file_path, args)
16
+ specmatic_config_file_path: str = '', args=None):
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
20
  self.__stub_running_success_message = 'Stub server is running on '
@@ -115,5 +115,4 @@ class SpecmaticStub(SpecmaticBase):
115
115
  self.__stub_started_event.set()
116
116
 
117
117
  def __create_stub_process_command(self):
118
- self.validate_mandatory_fields()
119
118
  return self.create_command_array('stub')
@@ -8,8 +8,8 @@ from specmatic.utils import get_junit_report_dir_path
8
8
 
9
9
  class SpecmaticTest(SpecmaticBase):
10
10
  def __init__(self, host: str = "127.0.0.1", port: int = 5000, project_root: str = '',
11
- specmatic_json_file_path: str = '', args=None, endpoints_api: str = ''):
12
- super().__init__(host, port, project_root, specmatic_json_file_path, args, endpoints_api)
11
+ specmatic_config_file_path: str = '', args=None, endpoints_api: str = ''):
12
+ super().__init__(host, port, project_root, specmatic_config_file_path, args, endpoints_api)
13
13
 
14
14
  def run(self):
15
15
  self._delete_existing_report_if_exists()
@@ -21,7 +21,6 @@ class SpecmaticTest(SpecmaticBase):
21
21
  shutil.rmtree(junit_report_dir_path)
22
22
 
23
23
  def _execute_tests(self):
24
- self.validate_mandatory_fields()
25
24
  cmd = self.create_command_array('test', get_junit_report_dir_path())
26
25
  print("command array:")
27
26
  print(cmd)
@@ -0,0 +1,2 @@
1
+ __version__ = '2.0.1'
2
+ __specmatic_version__ = '2.0.1'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: specmatic
3
- Version: 2.0.0
3
+ Version: 2.0.1
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,7 +15,7 @@ Requires-Dist: flask>=2.2.5
15
15
  Requires-Dist: sanic>=22.12.0
16
16
 
17
17
  # Specmatic Python
18
- This is a Python library to run [Specmatic](https://specmatic.in).
18
+ This is a Python library to run [Specmatic](https://specmatic.io).
19
19
  Specmatic is a contract driven development tool that allows us to turn OpenAPI contracts into executable specifications.
20
20
  <br/>Click below to learn more about Specmatic and Contract Driven Development<br/><br/>
21
21
  [![Specmatic - Contract Driven Development](https://img.youtube.com/vi/3HPgpvd8MGg/0.jpg)](https://www.youtube.com/watch?v=3HPgpvd8MGg "Specmatic - Contract Driven Development")
@@ -27,8 +27,8 @@ Specmatic is a contract driven development tool that allows us to turn OpenAPI c
27
27
 
28
28
  #### Running Contract Tests
29
29
  A contract test validates an open api specification against a running api service.
30
- The open api specification can be present either locally or in a [Central Contract Repository](https://specmatic.in/documentation/central_contract_repository.html)
31
- [Click here](https://specmatic.in/documentation/contract_tests.html) to learn more about contract tests.
30
+ The open api specification can be present either locally or in a [Central Contract Repository](https://specmatic.io/documentation/central_contract_repository.html)
31
+ [Click here](https://specmatic.io/documentation/contract_tests.html) to learn more about contract tests.
32
32
 
33
33
  #### How to use
34
34
  - Create a file called test_contract.py in your test folder.
@@ -82,12 +82,12 @@ pytest.main()
82
82
  - In this, we are passing:
83
83
  - an instance of your wsgi app like flask
84
84
  - app_host and app_port. If they are not specified, the app will be started on a random available port on 127.0.0.1.
85
- - You would need a [specmatic.json](https://specmatic.in/documentation/specmatic_json.html) file to be present in the root directory of your project.
85
+ - You would need a [specmatic config](https://specmatic.in/documentation/specmatic_json.html) file to be present in the root directory of your project.
86
86
  - an empty test class.
87
87
  - stub_host, stub_port, optional list of json files to set expectations on the stub.
88
88
  The stub_host, stub_port will be used to run the specmatic stub server.
89
89
  If they are not supplied, the stub will be started on a random available port on 127.0.0.1.
90
- [Click here](https://specmatic.in/documentation/service_virtualization_tutorial.html) to learn more about stubbing/service virtualization.
90
+ [Click here](https://specmatic.io/documentation/service_virtualization_tutorial.html) to learn more about stubbing/service virtualization.
91
91
  - You can run this test from either your IDE or command line by pointing pytest to your test folder:
92
92
  ``````pytest test -v -s``````
93
93
  - NOTE: Please ensure that you set the '-v' and '-s' flags while running pytest as otherwise pytest may swallow up the console output.
@@ -1,2 +0,0 @@
1
- __version__ = '2.0.0'
2
- __specmatic_version__ = '2.0.0'
File without changes
File without changes
File without changes
File without changes