Open-AutoTools 0.0.4__tar.gz → 0.0.4rc1__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.
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1/Open_AutoTools.egg-info}/PKG-INFO +28 -16
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/Open_AutoTools.egg-info/SOURCES.txt +0 -4
- open_autotools-0.0.4rc1/Open_AutoTools.egg-info/requires.txt +31 -0
- {open_autotools-0.0.4/Open_AutoTools.egg-info → open_autotools-0.0.4rc1}/PKG-INFO +28 -16
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autoip/commands.py +1 -2
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autoip/core.py +1 -1
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autotest/commands.py +8 -9
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/utils/performance.py +35 -67
- open_autotools-0.0.4rc1/requirements.txt +31 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/setup.py +17 -12
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autoip/test_autoip_integration.py +2 -2
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/utils/test_performance.py +28 -182
- open_autotools-0.0.4/Open_AutoTools.egg-info/requires.txt +0 -19
- open_autotools-0.0.4/autotools/utils/requirements.py +0 -21
- open_autotools-0.0.4/autotools/utils/text.py +0 -16
- open_autotools-0.0.4/requirements.txt +0 -10
- open_autotools-0.0.4/tests/autotools/utils/test_requirements.py +0 -148
- open_autotools-0.0.4/tests/autotools/utils/test_text.py +0 -93
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/LICENSE +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/MANIFEST.in +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/Open_AutoTools.egg-info/dependency_links.txt +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/Open_AutoTools.egg-info/entry_points.txt +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/Open_AutoTools.egg-info/top_level.txt +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/README.md +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autocaps/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autocaps/commands.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autocaps/core.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autoip/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autolower/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autolower/commands.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autolower/core.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autopassword/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autopassword/commands.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autopassword/core.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/autotest/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/cli.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/utils/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/utils/commands.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/utils/loading.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/utils/updates.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/autotools/utils/version.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/pyproject.toml +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/setup.cfg +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autocaps/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autocaps/test_autocaps_core.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autocaps/test_autocaps_integration.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autoip/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autoip/test_autoip_core.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autolower/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autolower/test_autolower_core.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autolower/test_autolower_integration.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autopassword/test_autopassword_core.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autopassword/test_autopassword_integration.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autotest/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autotest/test_autotest_core.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/utils/__init__.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/utils/test_updates.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/utils/test_version.py +0 -0
- {open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/test_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Open-AutoTools
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4rc1
|
|
4
4
|
Summary: A suite of automated tools accessible via CLI with a simple `autotools` command
|
|
5
5
|
Home-page: https://github.com/BabylooPro/Open-AutoTools
|
|
6
6
|
Author: BabylooPro
|
|
@@ -14,24 +14,37 @@ Classifier: Operating System :: OS Independent
|
|
|
14
14
|
Requires-Python: >=3.10
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist:
|
|
17
|
+
Requires-Dist: build>=1.4.0
|
|
18
|
+
Requires-Dist: wheel>=0.45.1
|
|
19
|
+
Requires-Dist: Brotli==1.1.0
|
|
20
|
+
Requires-Dist: certifi==2024.2.2
|
|
21
|
+
Requires-Dist: charset-normalizer==3.3.2
|
|
22
|
+
Requires-Dist: click==8.1.3
|
|
23
|
+
Requires-Dist: cryptography==42.0.2
|
|
21
24
|
Requires-Dist: halo>=0.0.31
|
|
22
|
-
Requires-Dist:
|
|
25
|
+
Requires-Dist: idna==3.6
|
|
26
|
+
Requires-Dist: importlib-metadata>=7.0.1
|
|
27
|
+
Requires-Dist: packaging>=23.0
|
|
28
|
+
Requires-Dist: platformdirs==4.2.0
|
|
29
|
+
Requires-Dist: pycryptodomex==3.20.0
|
|
30
|
+
Requires-Dist: pyperclip==1.8.2
|
|
31
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
32
|
+
Requires-Dist: requests>=2.32.2
|
|
33
|
+
Requires-Dist: tomli==2.0.1
|
|
34
|
+
Requires-Dist: tqdm==4.66.2
|
|
35
|
+
Requires-Dist: urllib3==2.2.1
|
|
36
|
+
Requires-Dist: websockets==13.0.1
|
|
37
|
+
Requires-Dist: yapf==0.40.2
|
|
38
|
+
Requires-Dist: zipp==3.17.0
|
|
23
39
|
Requires-Dist: netifaces>=0.11.0
|
|
24
40
|
Requires-Dist: speedtest-cli>=2.1.3
|
|
25
41
|
Requires-Dist: psutil>=5.9.0
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist: pytest>=
|
|
31
|
-
Requires-Dist: pytest-
|
|
32
|
-
Requires-Dist: pytest-sugar>=1.0.0; extra == "dev"
|
|
33
|
-
Requires-Dist: pytest-xdist>=3.5.0; extra == "dev"
|
|
34
|
-
Requires-Dist: pytest-timeout>=2.2.0; extra == "dev"
|
|
42
|
+
Requires-Dist: setuptools>=40.8.0
|
|
43
|
+
Requires-Dist: pytest>=7.4.0
|
|
44
|
+
Requires-Dist: pytest-cov>=4.1.0
|
|
45
|
+
Requires-Dist: pytest-sugar>=1.0.0
|
|
46
|
+
Requires-Dist: pytest-xdist>=3.5.0
|
|
47
|
+
Requires-Dist: pytest-timeout>=2.2.0
|
|
35
48
|
Dynamic: author
|
|
36
49
|
Dynamic: author-email
|
|
37
50
|
Dynamic: classifier
|
|
@@ -41,7 +54,6 @@ Dynamic: home-page
|
|
|
41
54
|
Dynamic: license
|
|
42
55
|
Dynamic: license-file
|
|
43
56
|
Dynamic: project-url
|
|
44
|
-
Dynamic: provides-extra
|
|
45
57
|
Dynamic: requires-dist
|
|
46
58
|
Dynamic: requires-python
|
|
47
59
|
Dynamic: summary
|
|
@@ -30,8 +30,6 @@ autotools/utils/__init__.py
|
|
|
30
30
|
autotools/utils/commands.py
|
|
31
31
|
autotools/utils/loading.py
|
|
32
32
|
autotools/utils/performance.py
|
|
33
|
-
autotools/utils/requirements.py
|
|
34
|
-
autotools/utils/text.py
|
|
35
33
|
autotools/utils/updates.py
|
|
36
34
|
autotools/utils/version.py
|
|
37
35
|
tests/__init__.py
|
|
@@ -51,7 +49,5 @@ tests/autotools/autotest/__init__.py
|
|
|
51
49
|
tests/autotools/autotest/test_autotest_core.py
|
|
52
50
|
tests/autotools/utils/__init__.py
|
|
53
51
|
tests/autotools/utils/test_performance.py
|
|
54
|
-
tests/autotools/utils/test_requirements.py
|
|
55
|
-
tests/autotools/utils/test_text.py
|
|
56
52
|
tests/autotools/utils/test_updates.py
|
|
57
53
|
tests/autotools/utils/test_version.py
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
build>=1.4.0
|
|
2
|
+
wheel>=0.45.1
|
|
3
|
+
Brotli==1.1.0
|
|
4
|
+
certifi==2024.2.2
|
|
5
|
+
charset-normalizer==3.3.2
|
|
6
|
+
click==8.1.3
|
|
7
|
+
cryptography==42.0.2
|
|
8
|
+
halo>=0.0.31
|
|
9
|
+
idna==3.6
|
|
10
|
+
importlib-metadata>=7.0.1
|
|
11
|
+
packaging>=23.0
|
|
12
|
+
platformdirs==4.2.0
|
|
13
|
+
pycryptodomex==3.20.0
|
|
14
|
+
pyperclip==1.8.2
|
|
15
|
+
python-dotenv>=1.0.0
|
|
16
|
+
requests>=2.32.2
|
|
17
|
+
tomli==2.0.1
|
|
18
|
+
tqdm==4.66.2
|
|
19
|
+
urllib3==2.2.1
|
|
20
|
+
websockets==13.0.1
|
|
21
|
+
yapf==0.40.2
|
|
22
|
+
zipp==3.17.0
|
|
23
|
+
netifaces>=0.11.0
|
|
24
|
+
speedtest-cli>=2.1.3
|
|
25
|
+
psutil>=5.9.0
|
|
26
|
+
setuptools>=40.8.0
|
|
27
|
+
pytest>=7.4.0
|
|
28
|
+
pytest-cov>=4.1.0
|
|
29
|
+
pytest-sugar>=1.0.0
|
|
30
|
+
pytest-xdist>=3.5.0
|
|
31
|
+
pytest-timeout>=2.2.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Open-AutoTools
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4rc1
|
|
4
4
|
Summary: A suite of automated tools accessible via CLI with a simple `autotools` command
|
|
5
5
|
Home-page: https://github.com/BabylooPro/Open-AutoTools
|
|
6
6
|
Author: BabylooPro
|
|
@@ -14,24 +14,37 @@ Classifier: Operating System :: OS Independent
|
|
|
14
14
|
Requires-Python: >=3.10
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist:
|
|
17
|
+
Requires-Dist: build>=1.4.0
|
|
18
|
+
Requires-Dist: wheel>=0.45.1
|
|
19
|
+
Requires-Dist: Brotli==1.1.0
|
|
20
|
+
Requires-Dist: certifi==2024.2.2
|
|
21
|
+
Requires-Dist: charset-normalizer==3.3.2
|
|
22
|
+
Requires-Dist: click==8.1.3
|
|
23
|
+
Requires-Dist: cryptography==42.0.2
|
|
21
24
|
Requires-Dist: halo>=0.0.31
|
|
22
|
-
Requires-Dist:
|
|
25
|
+
Requires-Dist: idna==3.6
|
|
26
|
+
Requires-Dist: importlib-metadata>=7.0.1
|
|
27
|
+
Requires-Dist: packaging>=23.0
|
|
28
|
+
Requires-Dist: platformdirs==4.2.0
|
|
29
|
+
Requires-Dist: pycryptodomex==3.20.0
|
|
30
|
+
Requires-Dist: pyperclip==1.8.2
|
|
31
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
32
|
+
Requires-Dist: requests>=2.32.2
|
|
33
|
+
Requires-Dist: tomli==2.0.1
|
|
34
|
+
Requires-Dist: tqdm==4.66.2
|
|
35
|
+
Requires-Dist: urllib3==2.2.1
|
|
36
|
+
Requires-Dist: websockets==13.0.1
|
|
37
|
+
Requires-Dist: yapf==0.40.2
|
|
38
|
+
Requires-Dist: zipp==3.17.0
|
|
23
39
|
Requires-Dist: netifaces>=0.11.0
|
|
24
40
|
Requires-Dist: speedtest-cli>=2.1.3
|
|
25
41
|
Requires-Dist: psutil>=5.9.0
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist: pytest>=
|
|
31
|
-
Requires-Dist: pytest-
|
|
32
|
-
Requires-Dist: pytest-sugar>=1.0.0; extra == "dev"
|
|
33
|
-
Requires-Dist: pytest-xdist>=3.5.0; extra == "dev"
|
|
34
|
-
Requires-Dist: pytest-timeout>=2.2.0; extra == "dev"
|
|
42
|
+
Requires-Dist: setuptools>=40.8.0
|
|
43
|
+
Requires-Dist: pytest>=7.4.0
|
|
44
|
+
Requires-Dist: pytest-cov>=4.1.0
|
|
45
|
+
Requires-Dist: pytest-sugar>=1.0.0
|
|
46
|
+
Requires-Dist: pytest-xdist>=3.5.0
|
|
47
|
+
Requires-Dist: pytest-timeout>=2.2.0
|
|
35
48
|
Dynamic: author
|
|
36
49
|
Dynamic: author-email
|
|
37
50
|
Dynamic: classifier
|
|
@@ -41,7 +54,6 @@ Dynamic: home-page
|
|
|
41
54
|
Dynamic: license
|
|
42
55
|
Dynamic: license-file
|
|
43
56
|
Dynamic: project-url
|
|
44
|
-
Dynamic: provides-extra
|
|
45
57
|
Dynamic: requires-dist
|
|
46
58
|
Dynamic: requires-python
|
|
47
59
|
Dynamic: summary
|
|
@@ -2,7 +2,6 @@ import click
|
|
|
2
2
|
from .core import run
|
|
3
3
|
from ..utils.loading import LoadingAnimation
|
|
4
4
|
from ..utils.updates import check_for_updates
|
|
5
|
-
from ..utils.text import safe_text
|
|
6
5
|
|
|
7
6
|
# CLI COMMAND TO DISPLAY NETWORK INFORMATION AND RUN DIAGNOSTICS
|
|
8
7
|
@click.command()
|
|
@@ -20,6 +19,6 @@ def autoip(test, speed, monitor, interval, ports, dns, location, no_ip):
|
|
|
20
19
|
test=test, speed=speed, monitor=monitor, interval=interval,
|
|
21
20
|
ports=ports, dns=dns, location=location, no_ip=no_ip
|
|
22
21
|
)
|
|
23
|
-
click.echo(
|
|
22
|
+
click.echo(output)
|
|
24
23
|
update_msg = check_for_updates()
|
|
25
24
|
if update_msg: click.echo(update_msg)
|
|
@@ -183,7 +183,7 @@ def _display_connectivity_tests(output):
|
|
|
183
183
|
output.append("\nConnectivity Tests:")
|
|
184
184
|
results = test_connectivity()
|
|
185
185
|
for name, success, latency in results:
|
|
186
|
-
status = f"
|
|
186
|
+
status = f"✓ {latency}ms" if success else "✗ Failed"
|
|
187
187
|
output.append(f"{name:<15} {status}")
|
|
188
188
|
|
|
189
189
|
# DISPLAYS LOCATION INFORMATION
|
|
@@ -4,7 +4,6 @@ import sys
|
|
|
4
4
|
import os
|
|
5
5
|
import re
|
|
6
6
|
from ..utils.updates import check_for_updates
|
|
7
|
-
from ..utils.text import safe_text
|
|
8
7
|
|
|
9
8
|
# CLI COMMAND TO RUN TEST SUITE WITH PYTEST
|
|
10
9
|
@click.command()
|
|
@@ -33,12 +32,12 @@ def _install_test_dependencies():
|
|
|
33
32
|
import pytest
|
|
34
33
|
import pytest_cov
|
|
35
34
|
except ImportError:
|
|
36
|
-
click.echo(
|
|
35
|
+
click.echo(click.style("\n❌ pytest and/or pytest-cov not found. Installing...", fg='yellow', bold=True))
|
|
37
36
|
try:
|
|
38
|
-
subprocess.run([
|
|
39
|
-
click.echo(
|
|
37
|
+
subprocess.run(['pip', 'install', 'pytest', 'pytest-cov'], check=True)
|
|
38
|
+
click.echo(click.style("✅ Successfully installed pytest and pytest-cov", fg='green', bold=True))
|
|
40
39
|
except subprocess.CalledProcessError as e:
|
|
41
|
-
click.echo(
|
|
40
|
+
click.echo(click.style(f"\n❌ Failed to install dependencies: {str(e)}", fg='red', bold=True))
|
|
42
41
|
sys.exit(1)
|
|
43
42
|
|
|
44
43
|
# BUILDS THE TEST COMMAND ARGUMENTS BY ADDING THE CORRECT TEST PATH AND OPTIONS
|
|
@@ -150,10 +149,10 @@ def _run_test_process(cmd):
|
|
|
150
149
|
coverage_data = _process_test_output(process)
|
|
151
150
|
_handle_test_result(process, coverage_data)
|
|
152
151
|
except subprocess.CalledProcessError as e:
|
|
153
|
-
click.echo(
|
|
152
|
+
click.echo(click.style(f"\n❌ TESTS FAILED WITH RETURN CODE {e.returncode}", fg='red', bold=True))
|
|
154
153
|
sys.exit(1)
|
|
155
154
|
except Exception as e:
|
|
156
|
-
click.echo(
|
|
155
|
+
click.echo(click.style(f"\n❌ ERROR RUNNING TESTS: {str(e)}", fg='red', bold=True))
|
|
157
156
|
sys.exit(1)
|
|
158
157
|
|
|
159
158
|
# PREPARES ENVIRONMENT FOR TEST PROCESS
|
|
@@ -199,8 +198,8 @@ def _process_test_output(process):
|
|
|
199
198
|
# HANDLES TEST RESULT AND DISPLAYS COVERAGE
|
|
200
199
|
def _handle_test_result(process, coverage_data):
|
|
201
200
|
if process.returncode == 0:
|
|
202
|
-
click.echo(
|
|
201
|
+
click.echo(click.style("\n✅ ALL TESTS PASSED !", fg='green', bold=True))
|
|
203
202
|
_display_coverage_metrics(coverage_data)
|
|
204
203
|
else:
|
|
205
|
-
click.echo(
|
|
204
|
+
click.echo(click.style("\n❌ SOME TESTS FAILED!", fg='red', bold=True))
|
|
206
205
|
sys.exit(1)
|
|
@@ -3,17 +3,11 @@ import gc
|
|
|
3
3
|
import sys
|
|
4
4
|
import time
|
|
5
5
|
import click
|
|
6
|
+
import resource
|
|
6
7
|
import tracemalloc
|
|
7
8
|
from contextlib import contextmanager
|
|
8
9
|
from typing import Dict, List, Tuple, Optional
|
|
9
10
|
|
|
10
|
-
try:
|
|
11
|
-
import resource
|
|
12
|
-
RESOURCE_AVAILABLE = True
|
|
13
|
-
except ImportError:
|
|
14
|
-
resource = None
|
|
15
|
-
RESOURCE_AVAILABLE = False
|
|
16
|
-
|
|
17
11
|
try:
|
|
18
12
|
import psutil
|
|
19
13
|
PSUTIL_AVAILABLE = True
|
|
@@ -25,10 +19,9 @@ ENABLE_PERFORMANCE_METRICS = False
|
|
|
25
19
|
if os.getenv('AUTOTOOLS_DISABLE_PERF', '').lower() in ('1', 'true', 'yes'): ENABLE_PERFORMANCE_METRICS = False
|
|
26
20
|
|
|
27
21
|
# FLAG TO ENABLE/DISABLE TRACEMALLOC (CAN BE SLOW IN PRODUCTION)
|
|
28
|
-
#
|
|
29
|
-
# DO NOT ENABLE BASED ON ARGUMENT VALUES TO AVOID FALSE POSITIVES (EXAMPLE: "test" AS COMMAND ARGUMENT)
|
|
22
|
+
# ENABLE BY DEFAULT IN TEST ENVIRONMENTS (DETECTED BY PRESENCE OF PYTEST OR TEST IN SYS.ARGV)
|
|
30
23
|
_ENV_TRACEMALLOC = os.getenv('AUTOTOOLS_ENABLE_TRACEMALLOC', '').lower() in ('1', 'true', 'yes')
|
|
31
|
-
_IS_TEST_ENV = 'pytest' in sys.modules or any(arg.
|
|
24
|
+
_IS_TEST_ENV = 'pytest' in sys.modules or any('test' in arg.lower() or 'pytest' in arg.lower() for arg in sys.argv)
|
|
32
25
|
ENABLE_TRACEMALLOC = _ENV_TRACEMALLOC or _IS_TEST_ENV
|
|
33
26
|
|
|
34
27
|
# PERFORMANCE METRICS COLLECTOR
|
|
@@ -140,72 +133,47 @@ class PerformanceMetrics:
|
|
|
140
133
|
|
|
141
134
|
# RECORDS CPU USAGE AT START
|
|
142
135
|
def _record_cpu_start(self):
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
self.cpu_user_start = cpu_times.user
|
|
147
|
-
self.cpu_sys_start = cpu_times.system
|
|
148
|
-
elif RESOURCE_AVAILABLE:
|
|
149
|
-
usage = resource.getrusage(resource.RUSAGE_SELF)
|
|
150
|
-
self.cpu_user_start = usage.ru_utime
|
|
151
|
-
self.cpu_sys_start = usage.ru_stime
|
|
152
|
-
else:
|
|
153
|
-
self.cpu_user_start = time.process_time()
|
|
154
|
-
self.cpu_sys_start = 0.0
|
|
136
|
+
usage = resource.getrusage(resource.RUSAGE_SELF)
|
|
137
|
+
self.cpu_user_start = usage.ru_utime
|
|
138
|
+
self.cpu_sys_start = usage.ru_stime
|
|
155
139
|
|
|
156
140
|
# RECORDS CPU USAGE AT END
|
|
157
141
|
def _record_cpu_end(self):
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
self.cpu_user_end = cpu_times.user
|
|
162
|
-
self.cpu_sys_end = cpu_times.system
|
|
163
|
-
elif RESOURCE_AVAILABLE:
|
|
164
|
-
usage = resource.getrusage(resource.RUSAGE_SELF)
|
|
165
|
-
self.cpu_user_end = usage.ru_utime
|
|
166
|
-
self.cpu_sys_end = usage.ru_stime
|
|
167
|
-
else:
|
|
168
|
-
self.cpu_user_end = time.process_time()
|
|
169
|
-
self.cpu_sys_end = 0.0
|
|
142
|
+
usage = resource.getrusage(resource.RUSAGE_SELF)
|
|
143
|
+
self.cpu_user_end = usage.ru_utime
|
|
144
|
+
self.cpu_sys_end = usage.ru_stime
|
|
170
145
|
|
|
171
146
|
# RECORDS MEMORY USAGE AT START
|
|
172
147
|
def _record_rss_start(self):
|
|
173
148
|
if PSUTIL_AVAILABLE:
|
|
174
149
|
process = psutil.Process()
|
|
175
150
|
self.rss_start = process.memory_info().rss / (1024 * 1024) # MB
|
|
176
|
-
|
|
151
|
+
else:
|
|
177
152
|
usage = resource.getrusage(resource.RUSAGE_SELF)
|
|
178
153
|
self.rss_start = usage.ru_maxrss / 1024 # MB (LINUX) OR KB (MACOS)
|
|
179
154
|
if sys.platform == 'darwin':
|
|
180
155
|
self.rss_start = self.rss_start / 1024 # CONVERT KB TO MB ON MACOS
|
|
181
|
-
else:
|
|
182
|
-
self.rss_start = 0.0
|
|
183
156
|
|
|
184
157
|
# RECORDS MEMORY USAGE AT END
|
|
185
158
|
def _record_rss_end(self):
|
|
186
|
-
if PSUTIL_AVAILABLE:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
# RECORDS MEMORY USAGE AT END USING PSUTIL
|
|
191
|
-
def _record_rss_end_psutil(self):
|
|
192
|
-
process = psutil.Process()
|
|
193
|
-
mem_info = process.memory_info()
|
|
194
|
-
self.rss_peak = mem_info.rss / (1024 * 1024) # MB
|
|
195
|
-
|
|
196
|
-
try:
|
|
197
|
-
if hasattr(process, 'memory_info_ex'):
|
|
198
|
-
mem_ext = process.memory_info_ex()
|
|
199
|
-
if hasattr(mem_ext, 'peak_wss'): self.rss_peak = max(self.rss_peak, mem_ext.peak_wss / (1024 * 1024))
|
|
200
|
-
except Exception:
|
|
201
|
-
pass
|
|
159
|
+
if PSUTIL_AVAILABLE:
|
|
160
|
+
process = psutil.Process()
|
|
161
|
+
mem_info = process.memory_info()
|
|
162
|
+
self.rss_peak = mem_info.rss / (1024 * 1024) # MB
|
|
202
163
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
164
|
+
try:
|
|
165
|
+
if hasattr(process, 'memory_info_ex'):
|
|
166
|
+
mem_ext = process.memory_info_ex()
|
|
167
|
+
if hasattr(mem_ext, 'peak_wss'):
|
|
168
|
+
self.rss_peak = max(self.rss_peak, mem_ext.peak_wss / (1024 * 1024))
|
|
169
|
+
except Exception:
|
|
170
|
+
pass
|
|
171
|
+
else:
|
|
172
|
+
usage = resource.getrusage(resource.RUSAGE_SELF)
|
|
173
|
+
rss_current = usage.ru_maxrss / 1024
|
|
174
|
+
if sys.platform == 'darwin':
|
|
175
|
+
rss_current = rss_current / 1024
|
|
176
|
+
self.rss_peak = max(self.rss_start, rss_current) if self.rss_start else rss_current
|
|
209
177
|
|
|
210
178
|
# RECORDS FILESYSTEM I/O AT START
|
|
211
179
|
def _record_fs_start(self):
|
|
@@ -249,15 +217,15 @@ class PerformanceMetrics:
|
|
|
249
217
|
|
|
250
218
|
# CALCULATES DURATION METRICS IN MILLISECONDS
|
|
251
219
|
def _calculate_durations(self) -> Tuple[float, float, float]:
|
|
252
|
-
total_duration_ms = (self.process_end - self.process_start) * 1000 if self.process_end
|
|
253
|
-
startup_duration_ms = (self.startup_end - self.startup_start) * 1000 if self.startup_end
|
|
254
|
-
command_duration_ms = (self.command_end - self.command_start) * 1000 if self.command_end
|
|
220
|
+
total_duration_ms = (self.process_end - self.process_start) * 1000 if self.process_end and self.process_start else 0
|
|
221
|
+
startup_duration_ms = (self.startup_end - self.startup_start) * 1000 if self.startup_end and self.startup_start else 0
|
|
222
|
+
command_duration_ms = (self.command_end - self.command_start) * 1000 if self.command_end and self.command_start else 0
|
|
255
223
|
return total_duration_ms, startup_duration_ms, command_duration_ms
|
|
256
224
|
|
|
257
225
|
# CALCULATES CPU TIME METRICS IN MILLISECONDS
|
|
258
226
|
def _calculate_cpu_time(self) -> Tuple[float, float, float]:
|
|
259
|
-
cpu_user_ms = (self.cpu_user_end - self.cpu_user_start) * 1000 if self.cpu_user_end
|
|
260
|
-
cpu_sys_ms = (self.cpu_sys_end - self.cpu_sys_start) * 1000 if self.cpu_sys_end
|
|
227
|
+
cpu_user_ms = (self.cpu_user_end - self.cpu_user_start) * 1000 if self.cpu_user_end and self.cpu_user_start else 0
|
|
228
|
+
cpu_sys_ms = (self.cpu_sys_end - self.cpu_sys_start) * 1000 if self.cpu_sys_end and self.cpu_sys_start else 0
|
|
261
229
|
cpu_time_total_ms = cpu_user_ms + cpu_sys_ms
|
|
262
230
|
return cpu_time_total_ms, cpu_user_ms, cpu_sys_ms
|
|
263
231
|
|
|
@@ -292,9 +260,9 @@ class PerformanceMetrics:
|
|
|
292
260
|
|
|
293
261
|
# CALCULATES FILESYSTEM I/O METRICS
|
|
294
262
|
def _calculate_fs_io(self) -> Tuple[int, int, int]:
|
|
295
|
-
fs_bytes_read_total = self.fs_read_end - self.fs_read_start if self.fs_read_end
|
|
296
|
-
fs_bytes_written_total = self.fs_write_end - self.fs_write_start if self.fs_write_end
|
|
297
|
-
fs_ops_count = self.fs_ops_end - self.fs_ops_start if self.fs_ops_end
|
|
263
|
+
fs_bytes_read_total = self.fs_read_end - self.fs_read_start if self.fs_read_end and self.fs_read_start else 0
|
|
264
|
+
fs_bytes_written_total = self.fs_write_end - self.fs_write_start if self.fs_write_end and self.fs_write_start else 0
|
|
265
|
+
fs_ops_count = self.fs_ops_end - self.fs_ops_start if self.fs_ops_end and self.fs_ops_start else 0
|
|
298
266
|
return fs_bytes_read_total, fs_bytes_written_total, fs_ops_count
|
|
299
267
|
|
|
300
268
|
# CALCULATES AND RETURNS ALL PERFORMANCE METRICS AS A DICTIONARY
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
build>=1.4.0
|
|
2
|
+
wheel>=0.45.1
|
|
3
|
+
Brotli==1.1.0
|
|
4
|
+
certifi==2024.2.2
|
|
5
|
+
charset-normalizer==3.3.2
|
|
6
|
+
click==8.1.3
|
|
7
|
+
cryptography==42.0.2
|
|
8
|
+
halo>=0.0.31
|
|
9
|
+
idna==3.6
|
|
10
|
+
importlib-metadata>=7.0.1
|
|
11
|
+
packaging>=23.0
|
|
12
|
+
platformdirs==4.2.0
|
|
13
|
+
pycryptodomex==3.20.0
|
|
14
|
+
pyperclip==1.8.2
|
|
15
|
+
python-dotenv>=1.0.0
|
|
16
|
+
requests>=2.32.2
|
|
17
|
+
tomli==2.0.1
|
|
18
|
+
tqdm==4.66.2
|
|
19
|
+
urllib3==2.2.1
|
|
20
|
+
websockets==13.0.1
|
|
21
|
+
yapf==0.40.2
|
|
22
|
+
zipp==3.17.0
|
|
23
|
+
netifaces>=0.11.0
|
|
24
|
+
speedtest-cli>=2.1.3
|
|
25
|
+
psutil>=5.9.0
|
|
26
|
+
setuptools>=40.8.0
|
|
27
|
+
pytest>=7.4.0
|
|
28
|
+
pytest-cov>=4.1.0
|
|
29
|
+
pytest-sugar>=1.0.0
|
|
30
|
+
pytest-xdist>=3.5.0
|
|
31
|
+
pytest-timeout>=2.2.0
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import os
|
|
2
|
-
import importlib.util
|
|
3
2
|
from setuptools import setup, find_packages
|
|
4
3
|
|
|
5
4
|
# READING README.MD FOR LONG DESCRIPTION
|
|
6
5
|
with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read()
|
|
7
6
|
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
read_requirements = requirements_module.read_requirements
|
|
7
|
+
# READING REQUIREMENTS FROM FILE
|
|
8
|
+
def read_requirements():
|
|
9
|
+
requirements_path = os.path.join(os.path.dirname(__file__), "requirements.txt")
|
|
10
|
+
with open(requirements_path, "r", encoding="utf-8") as fh:
|
|
11
|
+
requirements = []
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
for line in fh:
|
|
14
|
+
line = line.strip()
|
|
15
|
+
if line and not line.startswith("#"):
|
|
16
|
+
requirements.append(line)
|
|
17
|
+
|
|
18
|
+
return requirements
|
|
19
|
+
|
|
20
|
+
required = read_requirements()
|
|
17
21
|
|
|
18
22
|
# SETUP CONFIGURATION FOR PACKAGE DISTRIBUTION
|
|
19
23
|
setup(
|
|
20
24
|
name='Open-AutoTools',
|
|
21
|
-
version='0.0.4',
|
|
25
|
+
version='0.0.4-rc.1',
|
|
22
26
|
packages=find_packages(exclude=["tests", "tests.*"]),
|
|
23
27
|
include_package_data=True,
|
|
24
28
|
install_requires=required,
|
|
25
|
-
extras_require={ "dev": dev_required },
|
|
26
29
|
|
|
27
30
|
# ENTRY POINTS FOR CLI COMMANDS
|
|
28
31
|
entry_points='''
|
|
@@ -41,7 +44,9 @@ setup(
|
|
|
41
44
|
long_description=long_description,
|
|
42
45
|
long_description_content_type="text/markdown",
|
|
43
46
|
url="https://github.com/BabylooPro/Open-AutoTools",
|
|
44
|
-
project_urls={
|
|
47
|
+
project_urls={
|
|
48
|
+
"Bug Tracker": "https://github.com/BabylooPro/Open-AutoTools/issues",
|
|
49
|
+
},
|
|
45
50
|
license="MIT",
|
|
46
51
|
classifiers=[
|
|
47
52
|
"Programming Language :: Python :: 3.10",
|
{open_autotools-0.0.4 → open_autotools-0.0.4rc1}/tests/autotools/autoip/test_autoip_integration.py
RENAMED
|
@@ -38,8 +38,8 @@ def test_autoip_cli_test(mock_test):
|
|
|
38
38
|
assert result.exit_code == 0
|
|
39
39
|
assert "Google DNS" in result.output
|
|
40
40
|
assert "CloudFlare" in result.output
|
|
41
|
-
assert "
|
|
42
|
-
assert "
|
|
41
|
+
assert "✓ 20ms" in result.output
|
|
42
|
+
assert "✗ Failed" in result.output
|
|
43
43
|
|
|
44
44
|
# TEST FOR SPEED TEST
|
|
45
45
|
@patch('autotools.autoip.core.run_speedtest')
|