specmatic 0.7.7__py3-none-any.whl → 0.7.9__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/version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = '0.7.7'
1
+ __version__ = '0.7.9'
2
2
  __specmatic_version__ = '0.67.0'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: specmatic
3
- Version: 0.7.7
3
+ Version: 0.7.9
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
@@ -32,6 +32,8 @@ The open api specification can be present either locally or in a [Central Contra
32
32
  - Declare an empty class in it called 'TestContract'.
33
33
  Specmatic will use this class to inject tests dynamically into it when you run it via say PyTest.
34
34
 
35
+ ## WSGI Apps
36
+
35
37
  #### To run contract tests with a stub for a wsgi app (like Flask):
36
38
  ``````
37
39
  class TestContract:
@@ -59,6 +61,35 @@ Specmatic.test_wsgi_app(app,
59
61
  - You can run this test from either your IDE or command line by pointing pytest to your test folder:
60
62
  ``````pytest test -v -s``````
61
63
  - NOTE: Please ensure that you set the '-v' and '-s' flags while running pytest as otherwise pytest may swallow up the console output.
64
+ - [Click here](https://specmatic.in/documentation/service_virtualization_tutorial.html) to learn more about stubbing/service virtualization.
65
+
66
+ #### To run contract tests using a central contract repository:
67
+
68
+ ``````
69
+ Specmatic.test_wsgi_app(app,
70
+ TestContract,
71
+ project_root=PROJECT_ROOT,
72
+ stub_host=stub_host,
73
+ stub_port=stub_port,
74
+ expectation_files=[expectation_json_file])
75
+ ``````
76
+
77
+ - When using a [central contract repository](https://specmatic.in/documentation/central_contract_repository.html), provide the absolute path to the root folder
78
+ of your application in the 'project_root' parameter.
79
+ - You would need to have a specmatic.json file in your project root directory. [Click here](https://specmatic.in/documentation/central_contract_repository.html#specmaticjson) to learn
80
+ more about the specmatic.json file.
81
+
82
+
83
+ #### To run contract tests without a stub, set the 'with_stub' parameter as False:
84
+
85
+ ``````
86
+ Specmatic.test_wsgi_app(app,
87
+ TestContract,
88
+ with_stub=False,
89
+ project_root=ROOT_DIR)
90
+ ``````
91
+
92
+ ## ASGI Apps
62
93
 
63
94
  #### To run contract tests with a stub for an asgi app (like sanic):
64
95
  ``````
@@ -77,7 +108,18 @@ Specmatic.test_asgi_app('main:app',
77
108
  - the rest of the arguments are similar to that of the ``````Specmatic.test_wsgi_app()`````` method.
78
109
 
79
110
 
80
- - [Click here](https://specmatic.in/documentation/service_virtualization_tutorial.html) to learn more about stubbing/service virtualization.
111
+ ## Common Issues
112
+ - **'Error loading ASGI app'** error when running Specmatic.test_asgi_app()
113
+ This error occurs due to incorrect module being specified in the app module parameter 'module:app' string.
114
+
115
+ #### Solutions:
116
+ - Try to identify the correct module in which your app variable is instantiated/imported.
117
+ For example if your 'app' variable is declared in main.py, try passing 'main:app'.
118
+ - Try running the app using uvicorn directly:
119
+ `````` uvciron 'main:app' ``````
120
+ If you are able to get the app started using uvicorn, it will work with specmatic too.
121
+
122
+ ## Sample Projects
81
123
  - [Check out the Specmatic Order BFF Python repo](https://github.com/znsio/specmatic-order-bff-python/) to see more examples of how to use specmatic with a Flask app.
82
124
  - [Check out the Specmatic Order BFF Python Sanic repo](https://github.com/znsio/specmatic-order-bff-python-sanic/) to see more examples of how to use specmatic with a Sanic app.
83
125
  - [Check out the Specmatic Order API Python repo](https://github.com/znsio/specmatic-order-api-python/) to see an examples of how to just run tests without using a stub.
@@ -1,6 +1,6 @@
1
1
  specmatic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  specmatic/utils.py,sha256=6JDPqpO51ykl0MWCOa32jkUOXZ-0RZ6N5Ng9_7r7XaU,519
3
- specmatic/version.py,sha256=TwcJ8cxe8cfx0wSv0EFyVAvgtbm6mlT4rN5aCZA-mRc,55
3
+ specmatic/version.py,sha256=3j9vspSwxjc28ZVOEY5GmYzD-kxAKvOR925YMRQ8KG0,55
4
4
  specmatic/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  specmatic/core/decorators.py,sha256=rh70o8SUe04oCqbF07JHCjNvoPN5VkO1xT9NgNiN8ao,2565
6
6
  specmatic/core/specmatic.jar,sha256=S0FO6mbbx-7LNGI2dUiJQMEvU5YpxQptMCExW5DtiBo,87153377
@@ -17,7 +17,7 @@ specmatic/servers/app_server.py,sha256=RK8ah6pHN5wrj5QgtF-o-uMbXOVS7GgFChBzLW5U9
17
17
  specmatic/servers/asgi_server_thread.py,sha256=FHcYdhNLKPQqI0dBrF1n4QJHPpUNAPmIFGd2_J-zU0E,515
18
18
  specmatic/servers/wsgi_server.py,sha256=uSMxAAFOcnCN2zM5RzPZP0tyk5FLeimCCxhgWtP7_h0,593
19
19
  specmatic/servers/wsgi_server_thread.py,sha256=XUEYW7-FP1a-5EkQVGc3FI_jkDQBocArxHLiCn3JJvc,691
20
- specmatic-0.7.7.dist-info/METADATA,sha256=QwjWtjhKXhuURHjNYiWEB5Z1fQ0btlTc8FU_fCteu44,4611
21
- specmatic-0.7.7.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
22
- specmatic-0.7.7.dist-info/top_level.txt,sha256=E7kQ78YacKBoKKeKWR_N83exlG8r5J0wlzlGqFmvIfo,10
23
- specmatic-0.7.7.dist-info/RECORD,,
20
+ specmatic-0.7.9.dist-info/METADATA,sha256=BjZJgTtjm1tRc_8bAKLa8l0O4ubp5G61SM0Fvq3XOmc,6353
21
+ specmatic-0.7.9.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
22
+ specmatic-0.7.9.dist-info/top_level.txt,sha256=E7kQ78YacKBoKKeKWR_N83exlG8r5J0wlzlGqFmvIfo,10
23
+ specmatic-0.7.9.dist-info/RECORD,,