pytestomatio 2.8.2.dev21__tar.gz → 2.8.2.dev24__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.
Files changed (40) hide show
  1. {pytestomatio-2.8.2.dev21/pytestomatio.egg-info → pytestomatio-2.8.2.dev24}/PKG-INFO +1 -1
  2. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pyproject.toml +1 -1
  3. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/connect/connector.py +35 -27
  4. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24/pytestomatio.egg-info}/PKG-INFO +1 -1
  5. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/LICENSE +0 -0
  6. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/README.md +0 -0
  7. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/__init__.py +0 -0
  8. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/connect/__init__.py +0 -0
  9. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/connect/s3_connector.py +0 -0
  10. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/decor/__init__.py +0 -0
  11. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/decor/decorator_updater.py +0 -0
  12. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/decor/default.py +0 -0
  13. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/decor/pep8.py +0 -0
  14. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/main.py +0 -0
  15. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/testing/__init__.py +0 -0
  16. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/testing/code_collector.py +0 -0
  17. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/testing/testItem.py +0 -0
  18. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/testomatio/__init__.py +0 -0
  19. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/testomatio/testRunConfig.py +0 -0
  20. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/testomatio/testomat_item.py +0 -0
  21. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/testomatio/testomatio.py +0 -0
  22. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/utils/__init__.py +0 -0
  23. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/utils/helper.py +0 -0
  24. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/utils/parser_setup.py +0 -0
  25. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio/utils/validations.py +0 -0
  26. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio.egg-info/SOURCES.txt +0 -0
  27. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio.egg-info/dependency_links.txt +0 -0
  28. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio.egg-info/entry_points.txt +0 -0
  29. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio.egg-info/requires.txt +0 -0
  30. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/pytestomatio.egg-info/top_level.txt +0 -0
  31. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/setup.cfg +0 -0
  32. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/tests/sub/__init__.py +0 -0
  33. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/tests/sub/sub_mob/__init__.py +0 -0
  34. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/tests/sub/sub_mob/sub_sub_class_test.py +0 -0
  35. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/tests/sub/sub_mob/sub_sub_test.py +0 -0
  36. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/tests/sub/test_class_sub.py +0 -0
  37. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/tests/sub/test_sub.py +0 -0
  38. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/tests/test_class_root.py +0 -0
  39. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/tests/test_decorators.py +0 -0
  40. {pytestomatio-2.8.2.dev21 → pytestomatio-2.8.2.dev24}/tests/test_root.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytestomatio
3
- Version: 2.8.2.dev21
3
+ Version: 2.8.2.dev24
4
4
  Summary: Pytest plugin to sync test with testomat.io
5
5
  Author: Oleksii Ostapov, TikoQA
6
6
  Project-URL: Testomat.io, https://testomat.io/
@@ -13,7 +13,7 @@ version_provider = "pep621"
13
13
  update_changelog_on_bump = false
14
14
  [project]
15
15
  name = "pytestomatio"
16
- version = "2.8.2.dev21"
16
+ version = "2.8.2.dev24"
17
17
 
18
18
  dependencies = [
19
19
  "requests>=2.29.0",
@@ -17,21 +17,29 @@ class Connector:
17
17
  self.api_key = api_key
18
18
 
19
19
  @property
20
- def _session(self):
21
- """Resolve and apply proxy settings each time session is accessed."""
20
+ def session(self):
21
+ """Get the session, creating it and applying proxy settings if necessary."""
22
22
  if self._session is None:
23
23
  self._session = requests.Session()
24
+ self._apply_proxy_settings()
25
+ return self._session
26
+
27
+ @session.setter
28
+ def session(self, value):
29
+ """Allow setting a custom session, while still applying proxy settings."""
30
+ self._session = value
31
+ self._apply_proxy_settings()
24
32
 
33
+ def _apply_proxy_settings(self):
34
+ """Apply proxy settings based on environment variables."""
25
35
  http_proxy = getenv("HTTP_PROXY")
26
36
  if http_proxy:
27
37
  self._session.proxies = {"http": http_proxy, "https": http_proxy}
28
38
  self._session.verify = False
29
39
  else:
30
- self._session.proxies.clear()
40
+ self._session.proxies.clear() # Clear proxies if HTTP_PROXY is not set
31
41
  self._session.verify = True
32
42
 
33
- return self._session
34
-
35
43
  def load_tests(
36
44
  self,
37
45
  tests: list[TestItem],
@@ -65,14 +73,14 @@ class Connector:
65
73
 
66
74
  try:
67
75
  response = self._session.post(f'{self.base_url}/api/load?api_key={self.api_key}', json=request)
68
- except ConnectionError:
69
- log.error(f'Failed to connect to {self.base_url}')
76
+ except ConnectionError as ce:
77
+ log.error(f'Failed to connect to {self.base_url}: {ce}')
70
78
  return
71
- except HTTPError:
72
- log.error(f'Failed to connect to {self.base_url}')
79
+ except HTTPError as he:
80
+ log.error(f'HTTP error occurred while connecting to {self.base_url}: {he}')
73
81
  return
74
82
  except Exception as e:
75
- log.error(f'Generic exception happened. Please report an issue. {e}')
83
+ log.error(f'An unexpected exception occurred. Please report an issue: {e}')
76
84
  return
77
85
 
78
86
  if response.status_code < 400:
@@ -99,14 +107,14 @@ class Connector:
99
107
  filtered_request = {k: v for k, v in request.items() if v is not None}
100
108
  try:
101
109
  response = self._session.post(f'{self.base_url}/api/reporter', json=filtered_request)
102
- except ConnectionError:
103
- log.error(f'Failed to connect to {self.base_url}')
110
+ except ConnectionError as ce:
111
+ log.error(f'Failed to connect to {self.base_url}: {ce}')
104
112
  return
105
- except HTTPError:
106
- log.error(f'Failed to connect to {self.base_url}')
113
+ except HTTPError as he:
114
+ log.error(f'HTTP error occurred while connecting to {self.base_url}: {he}')
107
115
  return
108
116
  except Exception as e:
109
- log.error(f'Generic exception happened. Please report an issue. {e}')
117
+ log.error(f'An unexpected exception occurred. Please report an issue: {e}')
110
118
  return
111
119
 
112
120
  if response.status_code == 200:
@@ -133,10 +141,10 @@ class Connector:
133
141
  log.error(f'Failed to connect to {self.base_url}: {ce}')
134
142
  return
135
143
  except HTTPError as he:
136
- log.error(f'Failed to connect to {self.base_url}: {he}')
144
+ log.error(f'HTTP error occurred while connecting to {self.base_url}: {he}')
137
145
  return
138
146
  except Exception as e:
139
- log.error(f'Generic exception happened. Please report an issue: {e}')
147
+ log.error(f'An unexpected exception occurred. Please report an issue: {e}')
140
148
  return
141
149
 
142
150
  if response.status_code == 200:
@@ -175,14 +183,14 @@ class Connector:
175
183
  try:
176
184
  response = self._session.post(f'{self.base_url}/api/reporter/{run_id}/testrun?api_key={self.api_key}',
177
185
  json=filtered_request)
178
- except ConnectionError:
179
- log.error(f'Failed to connect to {self.base_url}')
186
+ except ConnectionError as ce:
187
+ log.error(f'Failed to connect to {self.base_url}: {ce}')
180
188
  return
181
- except HTTPError:
182
- log.error(f'Failed to connect to {self.base_url}')
189
+ except HTTPError as he:
190
+ log.error(f'HTTP error occurred while connecting to {self.base_url}: {he}')
183
191
  return
184
192
  except Exception as e:
185
- log.error(f'Generic exception happened. Please report an issue. {e}')
193
+ log.error(f'An unexpected exception occurred. Please report an issue: {e}')
186
194
  return
187
195
  if response.status_code == 200:
188
196
  log.info('Test status updated')
@@ -193,14 +201,14 @@ class Connector:
193
201
  try:
194
202
  self._session.put(f'{self.base_url}/api/reporter/{run_id}?api_key={self.api_key}',
195
203
  json={"status_event": status_event})
196
- except ConnectionError:
197
- log.error(f'Failed to connect to {self.base_url}')
204
+ except ConnectionError as ce:
205
+ log.error(f'Failed to connect to {self.base_url}: {ce}')
198
206
  return
199
- except HTTPError:
200
- log.error(f'Failed to connect to {self.base_url}')
207
+ except HTTPError as he:
208
+ log.error(f'HTTP error occurred while connecting to {self.base_url}: {he}')
201
209
  return
202
210
  except Exception as e:
203
- log.error(f'Generic exception happened. Please report an issue. {e}')
211
+ log.error(f'An unexpected exception occurred. Please report an issue: {e}')
204
212
  return
205
213
 
206
214
  def disconnect(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytestomatio
3
- Version: 2.8.2.dev21
3
+ Version: 2.8.2.dev24
4
4
  Summary: Pytest plugin to sync test with testomat.io
5
5
  Author: Oleksii Ostapov, TikoQA
6
6
  Project-URL: Testomat.io, https://testomat.io/