Skip to content

Commit

Permalink
[resoto][chore] Upgrade to tox 4 (#1438)
Browse files Browse the repository at this point in the history
* [resoto][chore] Upgrade to tox 4

* fix resotoworker

* move pyyaml to resotolib

* fix onprem
  • Loading branch information
aquamatthias authored Feb 13, 2023
1 parent 7c1c8fb commit 00cc6d5
Show file tree
Hide file tree
Showing 51 changed files with 114 additions and 65 deletions.
2 changes: 1 addition & 1 deletion plugins/aws/resoto_plugin_aws/resource/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def nodes(self, clazz: Optional[Type[AwsResourceType]] = None, **node: Any) -> I
for n in self.graph:
is_clazz = isinstance(n, clazz) if clazz else True
if is_clazz and all(getattr(n, k, None) == v for k, v in node.items()):
yield n # type: ignore
yield n

def add_node(
self, node: AwsResourceType, source: Optional[Json] = None, region: Optional[AwsRegion] = None
Expand Down
4 changes: 1 addition & 3 deletions plugins/aws/test/resources/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from resoto_plugin_aws.resource.base import ExecutorQueue, AwsRegion, GraphBuilder
from resoto_plugin_aws.resource.ec2 import AwsEc2InstanceType
from test import account_collector, builder, aws_client, aws_config, no_feedback # noqa: F401


def check_executor_queue(work: Sequence[int], fail_on_first_exception: bool) -> Tuple[List[int], Optional[Exception]]:
Expand Down Expand Up @@ -48,9 +49,6 @@ def test_fail_late() -> None:
assert ex.args[0] == "Abort 5"


from test import account_collector, builder, aws_client, aws_config, no_feedback # noqa: F401


def test_instance_type_handling(builder: GraphBuilder) -> None:
region1 = AwsRegion(id="us-east-1")
region2 = AwsRegion(id="us-east-2")
Expand Down
5 changes: 4 additions & 1 deletion plugins/aws/tools/awspolicygen/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand All @@ -14,7 +17,7 @@ deps =
-rrequirements.txt

[testenv:syntax]
commands = flake8 --verbose
commands = flake8

[testenv:black]
commands = black --line-length 120 --check --diff --target-version py39 .
2 changes: 1 addition & 1 deletion plugins/aws/tools/model_gen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import json
import json # noqa: F401
import re
from textwrap import dedent
from typing import List, Set, Optional, Tuple, Union, Dict
Expand Down
10 changes: 5 additions & 5 deletions plugins/aws/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black, mypy

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand All @@ -16,7 +19,7 @@ deps =
-r../../resotolib/requirements-test.txt

[testenv:syntax]
commands = flake8 --verbose
commands = flake8

[testenv:tests]
commands= pytest
Expand All @@ -25,7 +28,4 @@ commands= pytest
commands = black --line-length 120 --check --diff --target-version py39 .

[testenv:mypy]
commands=
- python -m mypy --python-version 3.9 resoto_plugin_aws test
- python -m mypy --install-types --non-interactive --python-version 3.9 resoto_plugin_aws test
python -m mypy --python-version 3.9 --strict resoto_plugin_aws test
commands= python -m mypy --install-types --non-interactive --python-version 3.9 --strict resoto_plugin_aws test
8 changes: 4 additions & 4 deletions plugins/aws_k8s/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black, mypy

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down Expand Up @@ -25,7 +28,4 @@ commands= pytest
commands = black --line-length 120 --check --diff --target-version py39 .

[testenv:mypy]
commands=
- python -m mypy --python-version 3.9 resoto_plugin_aws_k8s test
- python -m mypy --install-types --non-interactive --python-version 3.9 resoto_plugin_aws_k8s test
python -m mypy --python-version 3.9 --strict resoto_plugin_aws_k8s test
commands= python -m mypy --install-types --non-interactive --python-version 3.9 --strict resoto_plugin_aws_k8s test
1 change: 0 additions & 1 deletion plugins/cleanup_aws_alarms/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
resotolib==3.2.0
resoto-plugin-aws==3.2.0
PyYAML>=6.0
3 changes: 3 additions & 0 deletions plugins/cleanup_aws_alarms/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
3 changes: 3 additions & 0 deletions plugins/cleanup_aws_loadbalancers/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
1 change: 0 additions & 1 deletion plugins/cleanup_aws_vpcs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
resotolib==3.2.0
resoto-plugin-aws==3.2.0
PyYAML>=6.0
3 changes: 3 additions & 0 deletions plugins/cleanup_aws_vpcs/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
3 changes: 3 additions & 0 deletions plugins/cleanup_expired/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
1 change: 0 additions & 1 deletion plugins/cleanup_untagged/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
resotolib==3.2.0
PyYAML>=6.0
3 changes: 3 additions & 0 deletions plugins/cleanup_untagged/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
3 changes: 3 additions & 0 deletions plugins/cleanup_volumes/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
8 changes: 4 additions & 4 deletions plugins/digitalocean/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black, mypy

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down Expand Up @@ -25,7 +28,4 @@ commands= pytest
commands = black --line-length 120 --check --diff --target-version py39 .

[testenv:mypy]
commands=
- python -m mypy --python-version 3.9 resoto_plugin_digitalocean test
- python -m mypy --install-types --non-interactive --python-version 3.9 resoto_plugin_digitalocean test
python -m mypy --python-version 3.9 --strict resoto_plugin_digitalocean test
commands= python -m mypy --install-types --non-interactive --python-version 3.9 --strict resoto_plugin_digitalocean test
8 changes: 4 additions & 4 deletions plugins/digitalocean_k8s/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black, mypy

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down Expand Up @@ -25,7 +28,4 @@ commands= pytest
commands = black --line-length 120 --check --diff --target-version py39 .

[testenv:mypy]
commands=
- python -m mypy --python-version 3.9 resoto_plugin_digitalocean_k8s test
- python -m mypy --install-types --non-interactive --python-version 3.9 resoto_plugin_digitalocean_k8s test
python -m mypy --python-version 3.9 --strict resoto_plugin_digitalocean_k8s test
commands= python -m mypy --install-types --non-interactive --python-version 3.9 --strict resoto_plugin_digitalocean_k8s test
2 changes: 2 additions & 0 deletions plugins/dockerhub/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
Expand Down
3 changes: 3 additions & 0 deletions plugins/example_collector/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
4 changes: 1 addition & 3 deletions plugins/gcp/resoto_plugin_gcp/project_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ def collect_region(self, region: GcpRegion, regional_builder: GraphBuilder) -> N
cloud = Cloud(id="Gcp", name="Gcp")
project = GcpProject(id="inbound-axon-320811", name="inbound-axon-320811")
feedback = CoreFeedback("test", "test", "test", Queue())
Credentials._credentials[project.id] = OauthCredentials.from_service_account_file(
"/Users/matthias/.gcp/test.json"
)
Credentials._credentials[project.id] = OauthCredentials.from_service_account_file("/Users/matthias/.gcp/test.json")
Credentials._initialized = True
collector = GcpProjectCollector(GcpConfig(), cloud, project, feedback)
collector.collect()
Expand Down
3 changes: 1 addition & 2 deletions plugins/gcp/resoto_plugin_gcp/resources/container.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from typing import ClassVar, Dict, Optional, List

from attr import define, field
from resoto_plugin_aws.resource.base import GraphBuilder

from resoto_plugin_gcp.gcp_client import GcpApiSpec
from resoto_plugin_gcp.resources.base import GcpResource, GcpDeprecationStatus
from resoto_plugin_gcp.resources.base import GcpResource, GcpDeprecationStatus, GraphBuilder
from resotolib.baseresources import ModelReference
from resotolib.json_bender import Bender, S, Bend, ForallBend, MapDict
from resotolib.types import Json
Expand Down
3 changes: 1 addition & 2 deletions plugins/gcp/resoto_plugin_gcp/resources/sqladmin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from typing import ClassVar, Dict, Optional, List

from attr import define, field
from resoto_plugin_aws.resource.base import GraphBuilder

from resoto_plugin_gcp.gcp_client import GcpApiSpec
from resoto_plugin_gcp.resources.base import GcpResource, GcpDeprecationStatus
from resoto_plugin_gcp.resources.base import GcpResource, GcpDeprecationStatus, GraphBuilder
from resoto_plugin_gcp.resources.compute import GcpSslCertificate
from resotolib.baseresources import ModelReference
from resotolib.json_bender import Bender, S, Bend, ForallBend
Expand Down
3 changes: 3 additions & 0 deletions plugins/gcp/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = flake8, syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
2 changes: 2 additions & 0 deletions plugins/github/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
Expand Down
8 changes: 4 additions & 4 deletions plugins/k8s/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black, mypy

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache,test
Expand Down Expand Up @@ -25,7 +28,4 @@ commands= pytest
commands = black --line-length 120 --check --diff --target-version py39 .

[testenv:mypy]
commands=
- python -m mypy --python-version 3.9 resoto_plugin_k8s test
- python -m mypy --install-types --non-interactive --python-version 3.9 resoto_plugin_k8s test
python -m mypy --python-version 3.9 --strict resoto_plugin_k8s test
commands= python -m mypy --install-types --non-interactive --python-version 3.9 --strict resoto_plugin_k8s test
3 changes: 3 additions & 0 deletions plugins/onelogin/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
1 change: 0 additions & 1 deletion plugins/onprem/resoto_plugin_onprem/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
BaseInstance,
BaseNetwork,
)
from resotolib.logger import log


@define(eq=False, slots=False)
Expand Down
3 changes: 3 additions & 0 deletions plugins/onprem/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
2 changes: 2 additions & 0 deletions plugins/posthog/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
Expand Down
1 change: 0 additions & 1 deletion plugins/protector/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
resotolib==3.2.0
PyYAML>=6.0
3 changes: 3 additions & 0 deletions plugins/protector/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
3 changes: 3 additions & 0 deletions plugins/random/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
2 changes: 2 additions & 0 deletions plugins/scarf/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
Expand Down
3 changes: 3 additions & 0 deletions plugins/slack/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
1 change: 0 additions & 1 deletion plugins/tagvalidator/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
resotolib==3.2.0
PyYAML>=6.0
3 changes: 3 additions & 0 deletions plugins/tagvalidator/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
3 changes: 3 additions & 0 deletions plugins/vsphere/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black

[flake8]
max-line-length=120
exclude = .git,.tox,__pycache__,.idea,.pytest_cache
Expand Down
2 changes: 1 addition & 1 deletion resotocore/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mypy==1.0.0
wheel==0.38.4
flake8==6.0.0
pep8-naming==0.13.3
tox==3.28.0
tox==4.4.5
coverage==7.1.0
setuptools==67.2.0
pylint==2.16.1
Expand Down
1 change: 0 additions & 1 deletion resotocore/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ APScheduler==3.10.0
aiostream==0.4.5
tzlocal==4.2
frozendict==2.1.3 # 2.2.0 can not be marshalled as json any longer
PyYAML==6.0
resotolib==3.2.0
jq==1.4.0
posthog==2.3.1
Expand Down
10 changes: 5 additions & 5 deletions resotocore/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black, mypy

[pytest]
testpaths= tests
asyncio_mode= auto
Expand All @@ -11,7 +14,7 @@ deps =
-rrequirements.txt

[testenv:syntax]
commands = flake8 --verbose resotocore
commands = flake8 resotocore

[testenv:tests]
commands = pytest
Expand All @@ -20,7 +23,4 @@ commands = pytest
commands = black --line-length 120 --check --diff --target-version py39 .

[testenv:mypy]
commands=
- python -m mypy --python-version 3.9 resotocore tests
- python -m mypy --install-types --non-interactive --python-version 3.9 resotocore tests
python -m mypy --python-version 3.9 --strict resotocore tests
commands= python -m mypy --install-types --non-interactive --python-version 3.9 --strict resotocore tests
2 changes: 1 addition & 1 deletion resotoeventlog/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mypy==1.0.0
wheel==0.38.4
flake8==6.0.0
pep8-naming==0.13.3
tox==3.28.0
tox==4.4.5
coverage==7.1.0
black==23.1.0
build==0.10.0
8 changes: 4 additions & 4 deletions resotoeventlog/tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tox]
env_list = syntax, tests, black, mypy

[pytest]
testpaths= tests
asyncio_mode= auto
Expand All @@ -20,7 +23,4 @@ commands = pytest -s
commands = black --line-length 120 --check --diff --target-version py39 .

[testenv:mypy]
commands=
- python -m mypy --python-version 3.9 resotoeventlog tests
- python -m mypy --install-types --non-interactive --python-version 3.9 resotoeventlog tests
python -m mypy --python-version 3.9 --strict resotoeventlog tests
commands= python -m mypy --install-types --non-interactive --python-version 3.9 --strict resotoeventlog tests
Loading

0 comments on commit 00cc6d5

Please sign in to comment.