pytestomatio 2.8.2.dev29__tar.gz → 2.8.2.dev31__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.dev29/pytestomatio.egg-info → pytestomatio-2.8.2.dev31}/PKG-INFO +1 -1
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pyproject.toml +1 -1
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/connect/connector.py +20 -14
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/connect/s3_connector.py +9 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/testomatio/testomatio.py +18 -3
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31/pytestomatio.egg-info}/PKG-INFO +1 -1
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/LICENSE +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/README.md +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/__init__.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/connect/__init__.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/decor/__init__.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/decor/decorator_updater.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/decor/default.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/decor/pep8.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/main.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/testing/__init__.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/testing/code_collector.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/testing/testItem.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/testomatio/__init__.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/testomatio/testRunConfig.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/testomatio/testomat_item.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/utils/__init__.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/utils/helper.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/utils/parser_setup.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/utils/validations.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio.egg-info/SOURCES.txt +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio.egg-info/dependency_links.txt +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio.egg-info/entry_points.txt +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio.egg-info/requires.txt +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio.egg-info/top_level.txt +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/setup.cfg +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/tests/sub/__init__.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/tests/sub/sub_mob/__init__.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/tests/sub/sub_mob/sub_sub_class_test.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/tests/sub/sub_mob/sub_sub_test.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/tests/sub/test_class_sub.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/tests/sub/test_sub.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/tests/test_class_root.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/tests/test_decorators.py +0 -0
- {pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/tests/test_root.py +0 -0
|
@@ -5,6 +5,7 @@ from os.path import join, normpath
|
|
|
5
5
|
from os import getenv
|
|
6
6
|
from pytestomatio.utils.helper import safe_string_list
|
|
7
7
|
from pytestomatio.testing.testItem import TestItem
|
|
8
|
+
import time
|
|
8
9
|
|
|
9
10
|
log = logging.getLogger('pytestomatio')
|
|
10
11
|
|
|
@@ -35,30 +36,35 @@ class Connector:
|
|
|
35
36
|
if http_proxy:
|
|
36
37
|
self._session.proxies = {"http": http_proxy, "https": http_proxy}
|
|
37
38
|
self._session.verify = False
|
|
38
|
-
log.
|
|
39
|
+
log.debug(f"Proxy settings applied: {self._session.proxies}")
|
|
39
40
|
|
|
40
|
-
if not self._test_proxy_connection():
|
|
41
|
-
log.
|
|
41
|
+
if not self._test_proxy_connection(timeout=1):
|
|
42
|
+
log.debug("Proxy is unavailable. Falling back to a direct connection.")
|
|
42
43
|
self._session.proxies.clear()
|
|
43
44
|
self._session.verify = True
|
|
44
45
|
else:
|
|
45
|
-
log.
|
|
46
|
+
log.debug("No proxy settings found. Using a direct connection.")
|
|
46
47
|
self._session.proxies.clear()
|
|
47
48
|
self._session.verify = True
|
|
48
49
|
self._test_proxy_connection()
|
|
49
50
|
|
|
50
|
-
def _test_proxy_connection(self, test_url="https://api.ipify.org?format=json"):
|
|
51
|
-
"""Test if the proxy connection is available."""
|
|
51
|
+
def _test_proxy_connection(self, test_url="https://api.ipify.org?format=json", timeout=30, retry_interval=1):
|
|
52
52
|
log.debug("Current session: %s", self._session.proxies)
|
|
53
53
|
log.debug("Current verify: %s", self._session.verify)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
|
|
55
|
+
start_time = time.time()
|
|
56
|
+
while time.time() - start_time < timeout:
|
|
57
|
+
try:
|
|
58
|
+
response = self._session.get(test_url, timeout=5)
|
|
59
|
+
response.raise_for_status()
|
|
60
|
+
log.debug("Internet connection is available.")
|
|
61
|
+
return True
|
|
62
|
+
except requests.exceptions.RequestException as e:
|
|
63
|
+
log.error("Internet connection is unavailable. Error: %s", e)
|
|
64
|
+
time.sleep(retry_interval)
|
|
65
|
+
|
|
66
|
+
log.error("Internet connection check timed out after %d seconds.", timeout)
|
|
67
|
+
return False
|
|
62
68
|
|
|
63
69
|
def load_tests(
|
|
64
70
|
self,
|
|
@@ -49,6 +49,15 @@ class S3Connector:
|
|
|
49
49
|
self._is_logged_in = True
|
|
50
50
|
log.info('s3 session created')
|
|
51
51
|
|
|
52
|
+
# TODO: upload files async
|
|
53
|
+
def upload_files(self, file_list, bucket_name: str = None):
|
|
54
|
+
links = []
|
|
55
|
+
for file_path, key in file_list:
|
|
56
|
+
link = self.upload_file(file_path=file_path, key=key, bucket_name=bucket_name)
|
|
57
|
+
links.extend(link)
|
|
58
|
+
return [link for link in links if link is not None]
|
|
59
|
+
|
|
60
|
+
|
|
52
61
|
def upload_file(self, file_path: str, key: str = None, bucket_name: str = None) -> Optional[str]:
|
|
53
62
|
if not self._is_logged_in:
|
|
54
63
|
log.warning('s3 session is not created, creating new one')
|
|
@@ -2,6 +2,9 @@ from _pytest.python import Function
|
|
|
2
2
|
from .testRunConfig import TestRunConfig
|
|
3
3
|
from pytestomatio.connect.s3_connector import S3Connector
|
|
4
4
|
from pytestomatio.connect.connector import Connector
|
|
5
|
+
import logging
|
|
6
|
+
|
|
7
|
+
log = logging.getLogger(__name__)
|
|
5
8
|
|
|
6
9
|
|
|
7
10
|
class Testomatio:
|
|
@@ -23,7 +26,19 @@ class Testomatio:
|
|
|
23
26
|
return ""
|
|
24
27
|
return self.s3_connector.upload_file_object(file_bytes, key, bucket_name)
|
|
25
28
|
|
|
26
|
-
def add_artifacts(self,
|
|
27
|
-
|
|
29
|
+
def add_artifacts(self, *args) -> None:
|
|
30
|
+
urls = None
|
|
31
|
+
for arg in args:
|
|
32
|
+
if isinstance(arg, list):
|
|
33
|
+
urls = arg
|
|
34
|
+
if not urls:
|
|
35
|
+
log.warn("Failed to add artifacts. No valid list of url has been provided")
|
|
36
|
+
return
|
|
37
|
+
|
|
38
|
+
if not hasattr(self, "request"):
|
|
39
|
+
log.warn("Couldn't attach link to the test. Make sure pytestomatio is configured correctly.")
|
|
40
|
+
return
|
|
41
|
+
|
|
42
|
+
artifact_urls = self.request.node.stash.get("artifact_urls", [])
|
|
28
43
|
artifact_urls.extend(urls)
|
|
29
|
-
node.stash["artifact_urls"] = [ url for url in artifact_urls if url is not None]
|
|
44
|
+
self.request.node.stash["artifact_urls"] = [ url for url in artifact_urls if url is not None]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/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.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/testing/code_collector.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/testomatio/testRunConfig.py
RENAMED
|
File without changes
|
{pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio/testomatio/testomat_item.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/pytestomatio.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{pytestomatio-2.8.2.dev29 → pytestomatio-2.8.2.dev31}/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.dev29 → pytestomatio-2.8.2.dev31}/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
|