pytestomatio 2.8.2.dev39__tar.gz → 2.8.2.dev40__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.
- {pytestomatio-2.8.2.dev39/pytestomatio.egg-info → pytestomatio-2.8.2.dev40}/PKG-INFO +1 -1
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pyproject.toml +1 -1
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/connect/connector.py +50 -2
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40/pytestomatio.egg-info}/PKG-INFO +1 -1
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/LICENSE +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/README.md +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/__init__.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/connect/__init__.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/connect/s3_connector.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/decor/__init__.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/decor/decorator_updater.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/decor/default.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/decor/pep8.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/main.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/testing/__init__.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/testing/code_collector.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/testing/testItem.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/testomatio/__init__.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/testomatio/filter_plugin.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/testomatio/testRunConfig.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/testomatio/testomat_item.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/testomatio/testomatio.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/utils/__init__.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/utils/helper.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/utils/parser_setup.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/utils/validations.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio.egg-info/SOURCES.txt +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio.egg-info/dependency_links.txt +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio.egg-info/entry_points.txt +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio.egg-info/requires.txt +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio.egg-info/top_level.txt +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/setup.cfg +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/sub/__init__.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/sub/sub_mob/__init__.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/sub/sub_mob/sub_sub_class_test.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/sub/sub_mob/sub_sub_test.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/sub/test_class_sub.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/sub/test_sub.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/test_class_root.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/test_cli_param_test_id.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/test_cli_params.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/test_decorators.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/test_root.py +0 -0
- {pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/test_xdist.py +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import requests
|
|
1
|
+
import requests, time, logging
|
|
2
2
|
from requests.exceptions import HTTPError, ConnectionError
|
|
3
|
-
import logging
|
|
4
3
|
from os.path import join, normpath
|
|
5
4
|
from os import getenv
|
|
6
5
|
from pytestomatio.utils.helper import safe_string_list
|
|
@@ -17,6 +16,55 @@ class Connector:
|
|
|
17
16
|
self.jwt: str = ''
|
|
18
17
|
self.api_key = api_key
|
|
19
18
|
|
|
19
|
+
@property
|
|
20
|
+
def session(self):
|
|
21
|
+
"""Get the session, creating it and applying proxy settings if necessary."""
|
|
22
|
+
self._apply_proxy_settings()
|
|
23
|
+
return self._session
|
|
24
|
+
|
|
25
|
+
@session.setter
|
|
26
|
+
def session(self, value):
|
|
27
|
+
"""Allow setting a custom session, while still applying proxy settings."""
|
|
28
|
+
self._session = value
|
|
29
|
+
self._apply_proxy_settings()
|
|
30
|
+
|
|
31
|
+
def _apply_proxy_settings(self):
|
|
32
|
+
"""Apply proxy settings based on environment variables, fallback to no proxy if unavailable."""
|
|
33
|
+
http_proxy = getenv("HTTP_PROXY")
|
|
34
|
+
log.debug(f"HTTP_PROXY: {http_proxy}")
|
|
35
|
+
if http_proxy:
|
|
36
|
+
self._session.proxies = {"http": http_proxy, "https": http_proxy}
|
|
37
|
+
self._session.verify = False
|
|
38
|
+
log.debug(f"Proxy settings applied: {self._session.proxies}")
|
|
39
|
+
|
|
40
|
+
if not self._test_proxy_connection(timeout=1):
|
|
41
|
+
log.debug("Proxy is unavailable. Falling back to a direct connection.")
|
|
42
|
+
self._session.proxies.clear()
|
|
43
|
+
self._session.verify = True
|
|
44
|
+
else:
|
|
45
|
+
log.debug("No proxy settings found. Using a direct connection.")
|
|
46
|
+
self._session.proxies.clear()
|
|
47
|
+
self._session.verify = True
|
|
48
|
+
self._test_proxy_connection()
|
|
49
|
+
|
|
50
|
+
def _test_proxy_connection(self, test_url="https://api.ipify.org?format=json", timeout=30, retry_interval=1):
|
|
51
|
+
log.debug("Current session: %s", self._session.proxies)
|
|
52
|
+
log.debug("Current verify: %s", self._session.verify)
|
|
53
|
+
|
|
54
|
+
start_time = time.time()
|
|
55
|
+
while time.time() - start_time < timeout:
|
|
56
|
+
try:
|
|
57
|
+
response = self._session.get(test_url, timeout=5)
|
|
58
|
+
response.raise_for_status()
|
|
59
|
+
log.debug("Internet connection is available.")
|
|
60
|
+
return True
|
|
61
|
+
except requests.exceptions.RequestException as e:
|
|
62
|
+
log.error("Internet connection is unavailable. Error: %s", e)
|
|
63
|
+
time.sleep(retry_interval)
|
|
64
|
+
|
|
65
|
+
log.error("Internet connection check timed out after %d seconds.", timeout)
|
|
66
|
+
return False
|
|
67
|
+
|
|
20
68
|
def load_tests(
|
|
21
69
|
self,
|
|
22
70
|
tests: list[TestItem],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/decor/decorator_updater.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/testing/code_collector.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/testomatio/filter_plugin.py
RENAMED
|
File without changes
|
{pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/testomatio/testRunConfig.py
RENAMED
|
File without changes
|
{pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio/testomatio/testomat_item.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/pytestomatio.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev39 → pytestomatio-2.8.2.dev40}/tests/sub/sub_mob/sub_sub_class_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|