Skip to content

Commit

Permalink
ruff check --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hswong3i committed Jan 22, 2025
1 parent 1f72244 commit 0a91829
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 32 deletions.
7 changes: 3 additions & 4 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
import random
import shutil
import string
from pathlib import Path

import pytest

from pathlib import Path

from molecule import config, logger, util
from molecule.scenario import ephemeral_directory
from molecule import config, logger
from molecule.app import get_app
from molecule.scenario import ephemeral_directory

LOG = logger.get_logger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions src/molecule_plugins/podman/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@

import os
import warnings
from shutil import which
from pathlib import Path
from shutil import which

from ansible_compat.runtime import Runtime
from packaging.version import Version

from molecule import logger, util
from molecule.api import Driver, MoleculeRuntimeWarning
from molecule.app import get_app
from molecule.constants import RC_SETUP_ERROR
from molecule.util import sysexit_with_message
from molecule.app import get_app

log = logger.get_logger(__name__)

Expand Down
12 changes: 3 additions & 9 deletions src/molecule_plugins/vagrant/modules/vagrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,7 @@ def _conf_instance(self, instance_name):
try:
return self._vagrant.conf(vm_name=instance_name)
except Exception:
msg = "Failed to get vagrant config for {}: See log file '{}'".format(
instance_name,
self._get_stderr_log(),
)
msg = f"Failed to get vagrant config for {instance_name}: See log file '{self._get_stderr_log()}'"
with open(self._get_stderr_log(), encoding="utf-8") as f:
self.result["stderr"] = f.read()
self._module.fail_json(msg=msg, **self.result)
Expand All @@ -517,10 +514,7 @@ def _status_instance(self, instance_name):

return {"name": s.name, "state": s.state, "provider": s.provider}
except Exception:
msg = "Failed to get status for {}: See log file '{}'".format(
instance_name,
self._get_stderr_log(),
)
msg = f"Failed to get status for {instance_name}: See log file '{self._get_stderr_log()}'"
with open(self._get_stderr_log(), encoding="utf-8") as f:
self.result["stderr"] = f.read()
self._module.fail_json(msg=msg, **self.result)
Expand Down Expand Up @@ -697,7 +691,7 @@ def _get_stdout_log(self):
def _get_stderr_log(self):
return self._get_vagrant_log("err")

def _get_vagrant_log(self, __type):
def _get_vagrant_log(self, __type, /):
return os.path.join(self._config["workdir"], f"vagrant.{__type}")


Expand Down
3 changes: 1 addition & 2 deletions test/azure/functional/test_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
# DEALINGS IN THE SOFTWARE.

import os
from pathlib import Path

import pytest

from pathlib import Path

from conftest import change_dir_to
from molecule import logger
from molecule.app import get_app
Expand Down
1 change: 0 additions & 1 deletion test/containers/functional/test_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"""Functional Tests."""

import os

from pathlib import Path

from conftest import change_dir_to, molecule_directory
Expand Down
3 changes: 1 addition & 2 deletions test/docker/test_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
import pathlib
import shutil
import subprocess
from pathlib import Path

import pytest

from pathlib import Path

from conftest import change_dir_to
from molecule import logger
from molecule.app import get_app
Expand Down
3 changes: 1 addition & 2 deletions test/ec2/functional/test_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
# DEALINGS IN THE SOFTWARE.

import os
from pathlib import Path

import pytest

from pathlib import Path

from conftest import change_dir_to, metadata_lint_update
from molecule import logger
from molecule.app import get_app
Expand Down
3 changes: 1 addition & 2 deletions test/gce/functional/test_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
# DEALINGS IN THE SOFTWARE.

import os
from pathlib import Path

import pytest

from pathlib import Path

from conftest import change_dir_to, metadata_lint_update
from molecule import logger
from molecule.app import get_app
Expand Down
1 change: 0 additions & 1 deletion test/openstack/test_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pathlib
import shutil
import subprocess

from pathlib import Path

import pytest
Expand Down
1 change: 0 additions & 1 deletion test/podman/test_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
import pathlib
import subprocess

from pathlib import Path

from conftest import change_dir_to
Expand Down
10 changes: 4 additions & 6 deletions test/vagrant-plugin/functional/test_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@
import os
import platform
import shutil
from pathlib import Path

import pytest
import vagrant

from pathlib import Path

from conftest import change_dir_to
from molecule import logger, util
from molecule.scenario import ephemeral_directory
from molecule.app import get_app
from molecule.scenario import ephemeral_directory

LOG = logger.get_logger(__name__)

Expand All @@ -40,9 +39,8 @@ def is_vagrant_supported() -> bool:
"""Return True if vagrant is installed and current platform is supported."""
if not shutil.which("vagrant"):
return False
if platform.machine() == "arm64" and platform.system() == "Darwin":
return False
return True
if not (platform.machine() == "arm64" and platform.system() == "Darwin"):
return True


@pytest.mark.skipif(
Expand Down

0 comments on commit 0a91829

Please sign in to comment.