Skip to content

Commit

Permalink
fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gytsto committed Jan 10, 2025
1 parent 85ccea9 commit 12b067f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ black fix="false":
fi
pylint:
docker run --rm -t -v$(pwd):/code 'ubuntu:22.04' sh -c "apt-get update && apt-get -y install python3-pip && cd code && pip3 install --no-deps -r requirements.txt && pipenv install --system && cd nat-lab && pipenv install --system && pylint -f colorized . --ignore telio_bindings.py"
docker run --rm -t -v$(pwd):/code 'ubuntu:24.04' sh -c "apt-get update && apt-get -y install python3-pip && cd code && pip3 install --no-deps -r requirements.txt && pipenv install --system && cd nat-lab && pipenv install --system && pylint -f colorized . --ignore telio_bindings.py"

# Start a dev web cgi server, for local teliod cgi development
web:
Expand Down
40 changes: 16 additions & 24 deletions nat-lab/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,11 @@ def _cancel_all_tasks(loop: asyncio.AbstractEventLoop):
if task.cancelled():
continue
if task.exception() is not None:
loop.call_exception_handler(
{
"message": "unhandled exception during asyncio.run() shutdown",
"exception": task.exception(),
"task": task,
}
)
loop.call_exception_handler({
"message": "unhandled exception during asyncio.run() shutdown",
"exception": task.exception(),
"task": task,
})


@pytest.fixture(scope="function")
Expand Down Expand Up @@ -135,25 +133,21 @@ def execute_setup(vm_tag):
connection_tags = set()

# Setup for all Docker clients
connection_tags.update(
[
tag
for tag in ConnectionTag.__members__.values()
if tag.name.startswith("DOCKER_") and "CLIENT" in tag.name
]
)
connection_tags.update([
tag
for tag in ConnectionTag.__members__.values()
if tag.name.startswith("DOCKER_") and "CLIENT" in tag.name
])

# Handle test name (params) to search for VM tags
test_name = request.node.name
if "_VM_" in test_name:
# Extract all connection tags from test name
connection_tags.update(
[
ConnectionTag[param]
for param in test_name.split("[")[1].split("]")[0].split("-")
if param in ConnectionTag.__members__
]
)
connection_tags.update([
ConnectionTag[param]
for param in test_name.split("[")[1].split("]")[0].split("-")
if param in ConnectionTag.__members__
])

# Handle test markers to search for VMs tags
for mark in request.node.own_markers:
Expand All @@ -179,9 +173,7 @@ def pytest_make_parametrize_id(config, val):
param_id = f"{param_id[1:]}"
elif isinstance(val, (SetupParameters,)):
short_conn_tag_name = val.connection_tag.name.removeprefix("DOCKER_")
param_id = (
f"{short_conn_tag_name}-{val.adapter_type_override.name.replace('_', '') if val.adapter_type_override is not None else ''}"
)
param_id = f"{short_conn_tag_name}-{val.adapter_type_override.name.replace('_', '') if val.adapter_type_override is not None else ''}"
if (
val.features.direct is not None
and val.features.direct.providers is not None
Expand Down

0 comments on commit 12b067f

Please sign in to comment.