Repository: saltstack/pytest-salt-factories (language: python)

Issue:
The deffered imports change in 1.0.0rc22 broke the salt test suite.



Discussion / hints:

Fix patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index e9456fc9..9f95d578 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -2,7 +2,7 @@
 minimum_pre_commit_version: 1.15.2
 repos:
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.2.0
+    rev: v4.4.0
     hooks:
       - id: check-merge-conflict  # Check for files that contain merge conflict strings.
       - id: trailing-whitespace   # Trims trailing whitespace.
@@ -29,44 +29,41 @@ repos:
   # <---- Local Hooks ------------------------------------------------------------------------------------------------
 
   # ----- Formatting ------------------------------------------------------------------------------------------------>
+  - repo: https://github.com/charliermarsh/ruff-pre-commit
+    rev: "v0.0.280"
+    hooks:
+      - id: ruff
+        args:
+          - --fix
+        exclude: (.pre-commit-hooks/.*|docs/.*)\.py
   - repo: https://github.com/asottile/pyupgrade
-    rev: v2.32.0
+    rev: v3.9.0
     hooks:
       - id: pyupgrade
-        name: Rewrite Code to be Py3.5+
-        args: [--py3-plus]
+        name: Rewrite Code to be Py3.7+
+        args: [--py37-plus]
         exclude: (^src/saltfactories/utils/saltext/.*\.py)
 
-  - repo: https://github.com/asottile/reorder_python_imports
-    rev: v3.0.1
-    hooks:
-      - id: reorder-python-imports
-        args: [
-          --py3-plus,
-          --application-directories=.:src:examples/echo-extension/src
-        ]
-        exclude: src/saltfactories/version.py
-
   - repo: https://github.com/psf/black
-    rev: 22.3.0
+    rev: 23.7.0
     hooks:
       - id: black
         args: [-l 100]
         exclude: src/saltfactories/version.py
 
   - repo: https://github.com/asottile/blacken-docs
-    rev: v1.12.1
+    rev: 1.15.0
     hooks:
       - id: blacken-docs
         args: [--skip-errors]
         files: ^(.*\.rst|docs/.*\.rst|src/saltfactories/.*\.py)$
         additional_dependencies:
-          - black==22.3.0
+          - black==23.7.0
   # <---- Formatting -------------------------------------------------------------------------------------------------
 
   # ----- Security -------------------------------------------------------------------------------------------------->
   - repo: https://github.com/PyCQA/bandit
-    rev: "1.7.4"
+    rev: "1.7.5"
     hooks:
       - id: bandit
         alias: bandit-salt
@@ -77,7 +74,7 @@ repos:
                 tests/.*
             )$
   - repo: https://github.com/PyCQA/bandit
-    rev: "1.7.4"
+    rev: "1.7.5"
     hooks:
       - id: bandit
         alias: bandit-tests
@@ -87,16 +84,6 @@ repos:
   # <---- Security ---------------------------------------------------------------------------------------------------
 
   # ----- Code Analysis --------------------------------------------------------------------------------------------->
-  - repo: https://github.com/pycqa/flake8
-    rev: '4.0.1'
-    hooks:
-      - id: flake8
-        exclude: ^(src/saltfactories/version\.py|\.pre-commit-hooks/.*\.py)$
-        additional_dependencies:
-        - flake8-mypy-fork
-        - flake8-docstrings
-        - flake8-typing-imports
-        - pydocstyle>=6.1.1
 
 #  - repo: https://github.com/pre-commit/mirrors-mypy
 #    rev: v0.931
diff --git a/.pre-commit-hooks/check-changelog-entries.py b/.pre-commit-hooks/check-changelog-entries.py
index 9b2ced7b..fdfde43a 100755
--- a/.pre-commit-hooks/check-changelog-entries.py
+++ b/.pre-commit-hooks/check-changelog-entries.py
@@ -22,7 +22,6 @@
 
 
 def check_changelog_entries(files):
-
     exitcode = 0
     for entry in files:
         path = pathlib.Path(entry).resolve()
diff --git a/.pylint-spelling-words b/.pylint-spelling-words
index cc1eebf4..e3ce80e8 100644
--- a/.pylint-spelling-words
+++ b/.pylint-spelling-words
@@ -135,6 +135,7 @@ pytestshellutils
 pytestsysstats
 pythonic
 pythonpath
+pyyaml
 pyzmq
 qux
 rc
diff --git a/changelog/146.bugfix.rst b/changelog/146.bugfix.rst
new file mode 100644
index 00000000..9b8f8700
--- /dev/null
+++ b/changelog/146.bugfix.rst
@@ -0,0 +1,1 @@
+Do not blindly overwrite the `retuner_address` configuration key
diff --git a/changelog/149.improvement.rst b/changelog/149.improvement.rst
new file mode 100644
index 00000000..732be9ee
--- /dev/null
+++ b/changelog/149.improvement.rst
@@ -0,0 +1,7 @@
+Several improvements to reduce failure points:
+
+* Log the exception instead of raising it.
+* Always populate the `*_dirs` config settings, regardless of how salt-factories is being used
+* Improved the connect/disconnect behavior of the event listener client
+* The minimum supported Salt version is now 3005.0
+* The minimum supported Pytest version is now 7.0.0
diff --git a/changelog/149.trivial.rst b/changelog/149.trivial.rst
new file mode 100644
index 00000000..8142a05d
--- /dev/null
+++ b/changelog/149.trivial.rst
@@ -0,0 +1,1 @@
+Start checking the code base with ruff
diff --git a/docs/conf.py b/docs/conf.py
index b83b99f5..75288380 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -199,7 +199,7 @@ class IncludeExample(LiteralInclude):
 
     """
 
-    def __init__(self, *args, **kwargs):
+    def __init__(self, *args, **kwargs) -> None:
         super().__init__(*args, **kwargs)
         self.example_file = self.arguments[0]
         # Get the current doc path relative to the docs directory
diff --git a/examples/echo-extension/requirements/base.txt b/examples/echo-extension/requirements/base.txt
index 912456ff..235f6520 100644
--- a/examples/echo-extension/requirements/base.txt
+++ b/examples/echo-extension/requirements/base.txt
@@ -1,2 +1,1 @@
-salt~=3004.0
-jinja2<3.1
+salt
diff --git a/examples/echo-extension/src/echoext/states/echo_mod.py b/examples/echo-extension/src/echoext/states/echo_mod.py
index 0f7730a1..ae878b76 100644
--- a/examples/echo-extension/src/echoext/states/echo_mod.py
+++ b/examples/echo-extension/src/echoext/states/echo_mod.py
@@ -12,7 +12,7 @@ def echoed(name):
     value = __salt__["echo.text"](name)
     if value == name:
         ret["result"] = True
-        ret["comment"] = "The 'echo.echoed' returned: '{}'".format(value)
+        ret["comment"] = f"The 'echo.echoed' returned: '{value}'"
     return ret
 
 
@@ -24,5 +24,5 @@ def reversed(name):
     value = __salt__["echo.reverse"](name)
     if value == name[::-1]:
         ret["result"] = True
-        ret["comment"] = "The 'echo.reversed' returned: '{}'".format(value)
+        ret["comment"] = f"The 'echo.reversed' returned: '{value}'"
     return ret
diff --git a/noxfile.py b/noxfile.py
index fa16cb7d..03e059d7 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -1,3 +1,4 @@
+import contextlib
 import datetime
 import gzip
 import json
@@ -13,7 +14,7 @@
 from nox.logger import logger  # pylint: disable=import-error
 
 COVERAGE_VERSION_REQUIREMENT = "coverage==5.5"
-SALT_REQUIREMENT = os.environ.get("SALT_REQUIREMENT") or "salt>=3004"
+SALT_REQUIREMENT = os.environ.get("SALT_REQUIREMENT") or "salt>=3005"
 if SALT_REQUIREMENT == "salt==master":
     SALT_REQUIREMENT = "git+https://github.com/saltstack/salt.git@master"
 IS_WINDOWS = sys.platform.lower().startswith("win")
@@ -34,7 +35,7 @@
     or os.environ.get("GITHUB_ACTIONS")
 ) is None
 CI_RUN = PIP_INSTALL_SILENT is False
-SKIP_REQUIREMENTS_INSTALL = "SKIP_REQUIREMENTS_INSTALL" in os.environ
+SKIP_REQUIREMENTS_INSTALL = os.environ.get("SKIP_REQUIREMENTS_INSTALL", "0") == "1"
 EXTRA_REQUIREMENTS_INSTALL = os.environ.get("EXTRA_REQUIREMENTS_INSTALL")
 
 # Paths
@@ -50,7 +51,7 @@
     datetime.datetime.now().strftime("%Y%m%d%H%M%S.%f")
 )
 COVERAGE_REPORT_DB = REPO_ROOT / ".coverage"
-COVERAGE_REPORT_SALTFACTORIES = ARTIFACTS_DIR.relative_to(REPO_ROOT) / "coverage-saltfactories.xml"
+COVERAGE_REPORT_SALTFACTORIES = ARTIFACTS_DIR.relative_to(REPO_ROOT) / "coverage-project.xml"
 COVERAGE_REPORT_TESTS = ARTIFACTS_DIR.relative_to(REPO_ROOT) / "coverage-tests.xml"
 JUNIT_REPORT = ARTIFACTS_DIR.relative_to(REPO_ROOT) / "junit-report.xml"
 
@@ -72,8 +73,8 @@ def pytest_version(session):
             session,
             "python",
             "-c",
-            'import sys, pkg_resources; sys.stdout.write("{}".format('
-            'pkg_resources.get_distribution("pytest").version))',
+            'import sys, importlib_metadata; sys.stdout.write("{}".format('
+            'importlib_metadata.version("pytest")))',
             silent=True,
             log=False,
         )
@@ -83,6 +84,22 @@ def pytest_version(session):
     return session._runner._pytest_version_info
 
 
+def _get_session_python_version_info(session):
+    try:
+        version_info = session._runner._real_python_version_info
+    except AttributeError:
+        session_py_version = session.run_always(
+            "python",
+            "-c",
+            'import sys; sys.stdout.write("{}.{}.{}".format(*sys.version_info))',
+            silent=True,
+            log=False,
+        )
+        version_info = tuple(int(part) for part in session_py_version.split(".") if part.isdigit())
+        session._runner._real_python_version_info = version_info
+    return version_info
+
+
 def session_run_always(session, *command, **kwargs):
     """
     Patch nox to allow running some commands which would be skipped if --install-only is passed.
@@ -103,7 +120,7 @@ def session_run_always(session, *command, **kwargs):
             session._runner.global_config.install_only = old_install_only_value
 
 
-@nox.session(python=("3", "3.5", "3.6", "3.7", "3.8", "3.9"))
+@nox.session(python=("3", "3.6", "3.7", "3.8", "3.9", "3.10"))
 def tests(session):
     """
     Run tests.
@@ -111,56 +128,75 @@ def tests(session):
     env = {}
     system_service = session.python is False
     if SKIP_REQUIREMENTS_INSTALL is False:
+        python_version_info = _get_session_python_version_info(session)
         # Always have the wheel package installed
         session.install("wheel", silent=PIP_INSTALL_SILENT)
         session.install(COVERAGE_VERSION_REQUIREMENT, silent=PIP_INSTALL_SILENT)
-        salt_requirements = ["importlib-metadata<5.0.0"]
-        salt_requirements.append(SALT_REQUIREMENT)
-        if session.python is not False and system_service is False:
+        if python_version_info >= (3, 10) and "3006" in SALT_REQUIREMENT:
+            # Workaround pyyaml issue https://github.com/yaml/pyyaml/issues/601
             session.install(
-                *salt_requirements,
+                "--progress-bar=off",
+                "Cython<3.0",
+                "--no-build-isolation",
+                "pyyaml==5.4.1",
                 silent=PIP_INSTALL_SILENT,
-                # Use salt's pinned requirements
-                env={"USE_STATIC_REQUIREMENTS": "1"},
             )
+        salt_requirements = []
+        pytest_requirements = []
+        if python_version_info <= (3, 7) and "3005" in SALT_REQUIREMENT:
+            salt_requirements.append("importlib-metadata<5.0.0")
+        salt_requirements.append(SALT_REQUIREMENT)
+        if session.python is not False and system_service is False:
+            env["USE_STATIC_REQUIREMENTS"] = "1"
+
         pytest_version_requirement = os.environ.get("PYTEST_VERSION_REQUIREMENT") or None
         if pytest_version_requirement:
-            # Account that, under CI, when we test previous version of pytest
-            # we need to pin pytest-subtests to a lower version so that pytest
-            # itself does not get upgraded
-            pytest_requirements = ["importlib-metadata<5.0.0"]
             if not pytest_version_requirement.startswith("pytest"):
-                pytest_version_requirement = "pytest{}".format(pytest_version_requirement)
+                pytest_version_requirement = f"pytest{pytest_version_requirement}"
             pytest_requirements.append(pytest_version_requirement)
-            if pytest_version_requirement.startswith("pytest~=6"):
-                pytest_requirements.append("pytest-subtests<0.7.0")
-            session.install(*pytest_requirements, silent=PIP_INSTALL_SILENT)
-        if system_service:
-            session.install("importlib-metadata<5.0.0", ".", silent=PIP_INSTALL_SILENT)
-        else:
-            session.install("importlib-metadata<5.0.0", "-e", ".", silent=PIP_INSTALL_SILENT)
-        pip_list = session_run_always(
-            session, "pip", "list", "--format=json", silent=True, log=False, stderr=None
-        )
-        if pip_list:
-            for requirement in json.loads(pip_list.splitlines()[0]):
-                if requirement["name"] == "msgpack-python":
-                    logger.warning(
-                        "Found msgpack-python installed. Installing msgpack to override it"
-                    )
-                    session.install("msgpack=={}".format(requirement["version"]))
-                    break
-        session.install("-r", os.path.join("requirements", "tests.txt"), silent=PIP_INSTALL_SILENT)
 
-        if EXTRA_REQUIREMENTS_INSTALL:
-            session.log(
-                "Installing the following extra requirements because the EXTRA_REQUIREMENTS_INSTALL "
-                "environment variable was set: EXTRA_REQUIREMENTS_INSTALL='%s'",
-                EXTRA_REQUIREMENTS_INSTALL,
+        constraints = [*salt_requirements, *pytest_requirements]
+        with tempfile.NamedTemporaryFile(
+            "w", prefix="reqs-constraints-", suffix=".txt", delete=False
+        ) as tfile:
+            with open(tfile.name, "w", encoding="utf-8") as wfh:
+                for req in constraints:
+                    wfh.write(f"{req}\n")
+            if system_service:
+                if pytest_requirements:
+                    session.install(
+                        "-c", tfile.name, *pytest_requirements, silent=PIP_INSTALL_SILENT, env=env
+                    )
+                session.install("-c", tfile.name, ".", silent=PIP_INSTALL_SILENT, env=env)
+            else:
+                if constraints:
+                    session.install(
+                        "-c",
+                        tfile.name,
+                        *constraints,
+                        silent=PIP_INSTALL_SILENT,
+                        env=env,
+                    )
+                session.install("-c", tfile.name, "-e", ".", silent=PIP_INSTALL_SILENT)
+            session.install(
+                "-c",
+                tfile.name,
+                "-r",
+                os.path.join("requirements", "tests.txt"),
+                *constraints,
+                silent=PIP_INSTALL_SILENT,
+                env=env,
             )
-            install_command = ["--progress-bar=off"]
-            install_command += [req.strip() for req in EXTRA_REQUIREMENTS_INSTALL.split()]
-            session.install(*install_command, silent=PIP_INSTALL_SILENT)
+
+            if EXTRA_REQUIREMENTS_INSTALL:
+                session.log(
+                    "Installing the following extra requirements because the EXTRA_REQUIREMENTS_INSTALL "
+                    "environment variable was set: EXTRA_REQUIREMENTS_INSTALL='%s'",
+                    EXTRA_REQUIREMENTS_INSTALL,
+                )
+                install_command = ["--progress-bar=off", "-c", tfile.name]
+                install_command += [req.strip() for req in EXTRA_REQUIREMENTS_INSTALL.split()]
+                session.install(*install_command, silent=PIP_INSTALL_SILENT, env=env)
 
     session.run("coverage", "erase")
 
@@ -189,10 +225,10 @@ def tests(session):
     args = [
         "--rootdir",
         str(REPO_ROOT),
-        "--log-file={}".format(RUNTESTS_LOGFILE),
+        f"--log-file={RUNTESTS_LOGFILE}",
         "--log-file-level=debug",
         "--show-capture=no",
-        "--junitxml={}".format(JUNIT_REPORT),
+        f"--junitxml={JUNIT_REPORT}",
         "--showlocals",
         "--strict-markers",
         "-ra",
@@ -221,12 +257,11 @@ def tests(session):
     try:
         if system_service is False:
             # Always combine and generate the XML coverage report
-            try:
-                session.run("coverage", "combine")
-            except CommandFailed:
+            with contextlib.suppress(CommandFailed):
                 # Sometimes some of the coverage files are corrupt which would
                 # trigger a CommandFailed exception
-                pass
+                session.run("coverage", "combine")
+
             # Generate report for saltfactories code coverage
             session.run(
                 "coverage",
@@ -252,7 +287,7 @@ def tests(session):
                 "--include=src/saltfactories/*,tests/*",
             ]
             if system_service is False and pytest_version(session) >= (6, 2):
-                cmdline.append("--fail-under={}".format(COVERAGE_FAIL_UNDER_PERCENT))
+                cmdline.append(f"--fail-under={COVERAGE_FAIL_UNDER_PERCENT}")
             session.run(*cmdline)
     finally:
         if COVERAGE_REPORT_DB.exists():
@@ -261,9 +296,10 @@ def tests(session):
 
 def _lint(session, rcfile, extra_args, paths):
     if SKIP_REQUIREMENTS_INSTALL is False:
+        python_version_info = _get_session_python_version_info(session)
         salt_requirements = []
-        if "3003" in SALT_REQUIREMENT:
-            salt_requirements.append("jinja2<3.1")
+        if python_version_info <= (3, 7) and "3005" in SALT_REQUIREMENT:
+            salt_requirements.append("importlib-metadata<5.0.0")
         salt_requirements.append(SALT_REQUIREMENT)
         session.install(
             "--progress-bar=off",
@@ -281,7 +317,7 @@ def _lint(session, rcfile, extra_args, paths):
         session.run("pylint", "--version")
     pylint_report_path = os.environ.get("PYLINT_REPORT")
 
-    cmd_args = ["pylint", "--rcfile={}".format(rcfile)] + extra_args + paths
+    cmd_args = ["pylint", f"--rcfile={rcfile}", *extra_args, *paths]
 
     stdout = tempfile.TemporaryFile(mode="w+b")
     try:
@@ -306,8 +342,8 @@ def lint(session):
     """
     Run PyLint against Salt and it's test suite. Set PYLINT_REPORT to a path to capture output.
     """
-    session.notify("lint-code-{}".format(session.python))
-    session.notify("lint-tests-{}".format(session.python))
+    session.notify(f"lint-code-{session.python}")
+    session.notify(f"lint-tests-{session.python}")
 
 
 @nox.session(python="3", name="lint-code")
@@ -472,7 +508,7 @@ def changelog(session, draft):
         stderr=None,
     ).strip()
 
-    town_cmd = ["towncrier", "build", "--version={}".format(version)]
+    town_cmd = ["towncrier", "build", f"--version={version}"]
     if draft:
         town_cmd.append("--draft")
     session.run(*town_cmd)
@@ -495,7 +531,7 @@ def release(session):
     version = session.posargs[0]
     try:
         session.log("Generating temporary %s tag", version)
-        session.run("git", "tag", "-as", version, "-m", "Release {}".format(version), external=True)
+        session.run("git", "tag", "-as", version, "-m", f"Release {version}", external=True)
         changelog(session, draft=False)
     except CommandFailed:
         session.error("Failed to generate the temporary tag")
@@ -507,16 +543,14 @@ def release(session):
             "commit",
             "-a",
             "-m",
-            "Generate Changelog for version {}".format(version),
+            f"Generate Changelog for version {version}",
             external=True,
         )
     except CommandFailed:
         session.error("Failed to generate the release changelog")
     try:
         session.log("Overwriting temporary %s tag", version)
-        session.run(
-            "git", "tag", "-fas", version, "-m", "Release {}".format(version), external=True
-        )
+        session.run("git", "tag", "-fas", version, "-m", f"Release {version}", external=True)
     except CommandFailed:
         session.error("Failed to overwrite the temporary tag")
     session.warn("Don't forget to push the newly created tag")
@@ -527,7 +561,7 @@ class Recompress:
     Helper class to re-compress a ``.tag.gz`` file to make it reproducible.
     """
 
-    def __init__(self, mtime):
+    def __init__(self, mtime) -> None:
         self.mtime = int(mtime)
 
     def tar_reset(self, tarinfo):
@@ -554,27 +588,25 @@ def recompress(self, targz):
         d_src.mkdir()
         d_tar = tempd.joinpath(targz.stem)
         d_targz = tempd.joinpath(targz.name)
-        with tarfile.open(d_tar, "w|") as wfile:
-            with tarfile.open(targz, "r:gz") as rfile:
-                rfile.extractall(d_src)
-                extracted_dir = next(pathlib.Path(d_src).iterdir())
-                for name in sorted(extracted_dir.rglob("*")):
-                    wfile.add(
-                        str(name),
-                        filter=self.tar_reset,
-                        recursive=False,
-                        arcname=str(name.relative_to(d_src)),
-                    )
-
-        with open(d_tar, "rb") as rfh:
-            with gzip.GzipFile(
-                fileobj=open(d_targz, "wb"), mode="wb", filename="", mtime=self.mtime
-            ) as gz:  # pylint: disable=invalid-name
-                while True:
-                    chunk = rfh.read(1024)
-                    if not chunk:
-                        break
-                    gz.write(chunk)
+        with tarfile.open(d_tar, "w|") as wfile, tarfile.open(targz, "r:gz") as rfile:
+            rfile.extractall(d_src)  # nosec
+            extracted_dir = next(pathlib.Path(d_src).iterdir())
+            for name in sorted(extracted_dir.rglob("*")):
+                wfile.add(
+                    str(name),
+                    filter=self.tar_reset,
+                    recursive=False,
+                    arcname=str(name.relative_to(d_src)),
+                )
+
+        with open(d_tar, "rb") as rfh, gzip.GzipFile(
+            fileobj=open(d_targz, "wb"), mode="wb", filename="", mtime=self.mtime
+        ) as gz:  # pylint: disable=invalid-name
+            while True:
+                chunk = rfh.read(1024)
+                if not chunk:
+                    break
+                gz.write(chunk)
         targz.unlink()
         shutil.move(str(d_targz), str(targz))
 
diff --git a/pyproject.toml b/pyproject.toml
index b7e6f2e9..63a6b7d9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -47,3 +47,194 @@ issue_format = "`#{issue} <https://github.com/saltstack/pytest-salt-factories/is
   directory = "trivial"
   name = "Trivial/Internal Changes"
   showcontent = true
+
+[tool.ruff]
+line-length = 120
+select = [
+  "ALL",
+]
+unfixable = [
+  "PT023",  # (pytest-incorrect-mark-parentheses-style)
+]
+show-fixes = true
+show-source = true
+target-version = "py37"
+respect-gitignore = true
+src = [
+  "src",
+  "test"
+]
+extend-exclude = [
+  ".nox",
+  "examples",
+]
+extend-include = [
+  "setup.py",
+  "noxfile.py",
+  "src/**/*.pyi",
+]
+ignore-init-module-imports = true
+builtins = [
+  "__opts__",
+  "__salt__",
+  "__context__",
+  "__grains__",
+  "__pillar__",
+  "__salt_system_encoding__",
+]
+# Group violations by containing file.
+format = "grouped"
+ignore = [
+  "ANN",     # annotations
+  "PTH",     # Replace with pathlib.Path
+  "D107",    # Missing docstring in `__init__`
+  "D200",    # Reformat to one line
+  "D212",    # Remove whitespace after opening quotes
+  "COM",     # flake8-commas - Black takes care of this
+  "ERA",     # eradicate
+  "SIM108",  # Use ternary operator `A = X if Y else Z` instead of `if`-`else`-block
+  "PERF203", # `try`-`except` within a loop incurs performance overhead"
+  "PERF401", # Use a list comprehension to create a transformed list
+  "PERF402", # Use `list` or `list.copy` to create a copy of a list
+  "FBT001",  # Boolean positional arg in function definition
+  "FBT002",  # Boolean default value in function definition
+  "FBT003",  # Boolean positional value in function call
+  "PT001",   # use @pytest.fixture() over @pytest.fixture
+  "PT023",   # Use `@pytest.mark.<xyz>()` over `@pytest.mark.<xyz>`
+]
+
+[tool.ruff.per-file-ignores]
+"src/saltfactories/utils/ports.py" = [
+  "F403",
+  "D100",     # Missing docstring in public module
+]
+"src/saltfactories/utils/ports.pyi" = [
+  "F403",
+  "D100",     # Missing docstring in public module
+]
+"src/saltfactories/utils/processes.py" = [
+  "F403",
+  "D100",     # Missing docstring in public module
+]
+"src/saltfactories/utils/processes.pyi" = [
+  "F403",
+  "D100",     # Missing docstring in public module
+]
+"src/saltfactories/utils/functional.py" = [
+  "A003",     # Class attribute `id` is shadowing a Python builtin
+  "BLE001",   # Do not catch blind exception: `Exception`
+]
+"src/saltfactories/utils/saltext/**/*.py" = [
+  "ANN",    # Ignore missing type annotations
+  "UP032",  # Use f-string instead of `format` call
+]
+"src/saltfactories/utils/saltext/log_handlers/pytest_log_handler.py" = [
+  "BLE001",   # Do not catch blind exception: `Exception`
+]
+"src/**/*.py" = [
+  "D104",     # Missing docstring in public package
+]
+"src/saltfactories/__main__.py" = [
+  "T201",     # `print` found
+]
+"src/saltfactories/bases.py" = [
+  "SLF001",   # Private member accessed
+]
+"src/saltfactories/manager.py" = [
+  "SLF001",   # Private member accessed
+  "D417",     # Missing argument descriptions in the docstring
+  "PLR0913",  # Too many arguments to function call
+]
+"src/saltfactories/cli/cloud.py" = [
+  "ARG003",   # Unused class method argument
+]
+"src/saltfactories/daemons/container.py" = [
+  "ARG002",   # Unused method argument
+  "BLE001",   # Do not catch blind exception: `Exception`
+  "TD003",    # Missing issue link on the line following this TODO
+  "FIX002",   # Line contains TODO, consider resolving the issue
+]
+"src/saltfactories/daemons/master.py" = [
+  "D417",     # Missing argument descriptions in the docstring
+]
+"src/saltfactories/utils/markers.py" = [
+  "SLF001",   # Private member accessed
+]
+"src/saltfactories/utils/coverage/sitecustomize.py" = [
+  "D100",     # Missing docstring in public module
+  "INP001",   # File * is part of an implicit namespace package. Add an `__init__.py`
+]
+"src/saltfactories/plugins/loader.py" = [
+  "B018",   # Found useless expression. Either assign it to a variable or remove it.
+  "SLF001",   # Private member accessed
+]
+"src/saltfactories/plugins/log_server.py" = [
+  "BLE001",   # Do not catch blind exception: `Exception`
+]
+"tests/**/*.py" = [
+  "ANN",      # Ignore missing type annotations in tests
+  "PTH",      # Convert to pathlib.Path
+  "ARG001",   # Unused function argument
+  "D100",     # Missing docstring in public module
+  "D103",     # Missing docstring in public function
+  "D104",     # Missing docstring in public package
+  "DTZ003",   # The use of `datetime.datetime.utcnow()` is not allowed, use `datetime.datetime.now(tz=)` instead
+  "PLR2004",  # Magic value used in comparison, consider replacing 3 with a constant variable
+  "PT007",    # Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple`
+  "RET504",   # Unnecessary variable assignment before `return` statement"
+  "S101",     # Ignore the use of 'assert ...' in tests
+  "S603",     # `subprocess` call: check for execution of untrusted input
+  "SIM117",   # Use a single `with` statement with multiple contexts instead of nested `with` statements
+  "TCH002",   # Move third-party import into a type-checking block
+  "TCH003",   # Move standard library import `pathlib` into a type-checking block
+  "SLF001",   # Private member accessed
+  "D205",     # 1 blank line required between summary line and description
+]
+"tests/functional/loader/test_fixture_deps.py" = [
+  "B018", # Found useless expression. Either assign it to a variable or remove it.
+]
+"tests/functional/loader/test_loader.py" = [
+  "B018", # Found useless expression. Either assign it to a variable or remove it.
+]
+"setup.py" = [
+  "D",
+  "EXE001",   # Shebang is present but file is not executable
+]
+"noxfile.py" = [
+  "D",
+  "ANN",
+  "PTH",
+  "SLF001",
+  "C901",
+  "PLR0912",
+  "DTZ005",
+  "FBT002",
+  "PLR0913", # Too many arguments to function call"
+  "PLR0915", # Too many statements
+]
+
+[tool.ruff.pydocstyle]
+# Use Google-style docstrings.
+convention = "google"
+
+[tool.ruff.isort]
+combine-as-imports = false
+force-single-line = true
+known-first-party = ["src"]
+forced-separate = ["tests"]
+
+[tool.ruff.flake8-quotes]
+docstring-quotes = "double"
+
+[tool.ruff.mccabe]
+max-complexity = 20
+
+[tool.ruff.pylint]
+max-args = 10
+max-branches = 25
+max-returns = 8
+
+[tool.ruff.pep8-naming]
+ignore-names = [
+  "__virtual__",
+]
diff --git a/requirements/base.txt b/requirements/base.txt
index c4c5d573..7143caac 100644
--- a/requirements/base.txt
+++ b/requirements/base.txt
@@ -1,4 +1,4 @@
-pytest>=6.0.0
+pytest>=7.0.0
 attrs>=19.2.0
 pytest-tempdir>=2019.9.16
 pytest-helpers-namespace>=2021.4.29
diff --git a/setup.cfg b/setup.cfg
index 3d815646..0e90cbdc 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -45,7 +45,7 @@ exclude =
 docker=
   docker>=4.0.0
 salt=
-  salt>=3004
+  salt>=3005
 
 [requirements-files]
 install_requires = requirements/base.txt
diff --git a/src/saltfactories/__init__.py b/src/saltfactories/__init__.py
index cf2e270e..e2265864 100644
--- a/src/saltfactories/__init__.py
+++ b/src/saltfactories/__init__.py
@@ -1,3 +1,4 @@
+import contextlib
 import pathlib
 import re
 import sys
@@ -7,34 +8,25 @@
 except ImportError:  # pragma: no cover
     __version__ = "0.0.0.not-installed"
     try:
-        from importlib.metadata import version, PackageNotFoundError
+        from importlib.metadata import PackageNotFoundError
+        from importlib.metadata import version
 
-        try:
+        with contextlib.suppress(PackageNotFoundError):
             __version__ = version("pytest-salt-factories")
-        except PackageNotFoundError:
-            # package is not installed
-            pass
     except ImportError:
         try:
-            from importlib_metadata import version, PackageNotFoundError
+            from importlib_metadata import PackageNotFoundError
+            from importlib_metadata import version
 
-            try:
+            with contextlib.suppress(PackageNotFoundError):
                 __version__ = version("pytest-salt-factories")
-            except PackageNotFoundError:
-                # package is not installed
-                pass
         except ImportError:
-            try:
-                from pkg_resources import get_distribution, DistributionNotFound
+            with contextlib.suppress(ImportError):
+                from pkg_resources import DistributionNotFound
+                from pkg_resources import get_distribution
 
-                try:
+                with contextlib.suppress(DistributionNotFound):
                     __version__ = get_distribution("pytest-salt-factories").version
-                except DistributionNotFound:
-                    # package is not installed
-                    pass
-            except ImportError:
-                # pkg resources isn't even available?!
-                pass
 
 
 # Define __version_info__ attribute
diff --git a/src/saltfactories/bases.py b/src/saltfactories/bases.py
index 111e66fb..24a4e331 100644
--- a/src/saltfactories/bases.py
+++ b/src/saltfactories/bases.py
@@ -47,7 +47,7 @@ class SaltMixin:
     """
 
     config = attr.ib(repr=False)
-    id = attr.ib(init=False)  # pylint: disable=invalid-name
+    id = attr.ib(init=False)  # noqa: A003  pylint: disable=invalid-name
     config_file = attr.ib(init=False)
     config_dir = attr.ib()
     python_executable = attr.ib(default=None)
@@ -83,7 +83,7 @@ def get_display_name(self):
         Returns a human readable name for the factory.
         """
         if self.display_name is None:
-            self.display_name = "{}(id={!r})".format(self.__class__.__name__, self.id)
+            self.display_name = f"{self.__class__.__name__}(id={self.id!r})"
         if self.display_name is not None:
             return self.display_name
         return super().get_display_name()
@@ -161,7 +161,7 @@ def get_minion_tgt(self, minion_tgt=None):
         """
         return minion_tgt
 
-    def cmdline(
+    def cmdline(  # noqa: C901,PLR0912,PLR0915
         self, *args, minion_tgt=None, merge_json_output=None, **kwargs
     ):  # pylint: disable=arguments-differ
         """
@@ -201,7 +201,7 @@ def cmdline(
             if arg in ("-c", "--config-dir"):
                 break
         else:
-            cmdline.append("--config-dir={}".format(self.config_dir))
+            cmdline.append(f"--config-dir={self.config_dir}")
 
         # Handle the timeout CLI flag, if supported
         if self.__cli_timeout_supported__:
@@ -215,11 +215,10 @@ def cmdline(
                     except ValueError:
                         # Not a number? Let salt do it's error handling
                         break
-                    if self.impl._terminal_timeout is None:
-                        self.impl._terminal_timeout = (
-                            int(salt_cli_timeout) + SALT_TIMEOUT_FLAG_INCREASE
-                        )
-                    elif salt_cli_timeout >= self.impl._terminal_timeout:
+                    if (
+                        self.impl._terminal_timeout is None
+                        or salt_cli_timeout >= self.impl._terminal_timeout
+                    ):
                         self.impl._terminal_timeout = (
                             int(salt_cli_timeout) + SALT_TIMEOUT_FLAG_INCREASE
                         )
@@ -230,11 +229,10 @@ def cmdline(
                     except ValueError:
                         # Not a number? Let salt do it's error handling
                         break
-                    if self.impl._terminal_timeout is None:
-                        self.impl._terminal_timeout = (
-                            int(salt_cli_timeout) + SALT_TIMEOUT_FLAG_INCREASE
-                        )
-                    if salt_cli_timeout >= self.impl._terminal_timeout:
+                    if (
+                        self.impl._terminal_timeout is None
+                        or salt_cli_timeout >= self.impl._terminal_timeout
+                    ):
                         self.impl._terminal_timeout = (
                             int(salt_cli_timeout) + SALT_TIMEOUT_FLAG_INCREASE
                         )
@@ -244,15 +242,18 @@ def cmdline(
                     continue
             else:
                 salt_cli_timeout = self.timeout
-                if salt_cli_timeout and self.impl._terminal_timeout:
-                    if self.impl._terminal_timeout > salt_cli_timeout:
-                        salt_cli_timeout = self.impl._terminal_timeout
+                if (
+                    salt_cli_timeout
+                    and self.impl._terminal_timeout
+                    and self.impl._terminal_timeout > salt_cli_timeout
+                ):
+                    salt_cli_timeout = self.impl._terminal_timeout
                 if not salt_cli_timeout and self.impl._terminal_timeout:
                     salt_cli_timeout = self.impl._terminal_timeout
                 if salt_cli_timeout:
                     self.impl._terminal_timeout = salt_cli_timeout + SALT_TIMEOUT_FLAG_INCREASE
                     # Add it to the salt command CLI flags
-                    cmdline.append("--timeout={}".format(salt_cli_timeout))
+                    cmdline.append(f"--timeout={salt_cli_timeout}")
 
         # Handle the output flag
         if self.__cli_output_supported__:
@@ -297,16 +298,15 @@ def cmdline(
         # Keyword arguments get passed as KEY=VALUE pairs to the CLI
         for key, value in kwargs.items():
             if not isinstance(value, str):
-                value = json.dumps(value)
-            cmdline.append("{}={}".format(key, value))
+                value = json.dumps(value)  # noqa: PLW2901
+            cmdline.append(f"{key}={value}")
         cmdline = super().cmdline(*cmdline)
-        if self.python_executable:
-            if cmdline[0] != self.python_executable:
-                cmdline.insert(0, self.python_executable)
+        if self.python_executable and cmdline[0] != self.python_executable:
+            cmdline.insert(0, self.python_executable)
         log.debug("Built cmdline: %s", cmdline)
         return cmdline
 
-    def process_output(self, stdout, stderr, cmdline=None):
+    def process_output(self, stdout, stderr, cmdline=None):  # noqa: ARG002
         """
         Process the output. When possible JSON is loaded from the output.
 
@@ -320,10 +320,9 @@ def process_output(self, stdout, stderr, cmdline=None):
                 json_out = json.loads(stdout)
             except ValueError:
                 if self.__merge_json_output__:
-                    try:
+                    with contextlib.suppress(ValueError):
                         json_out = json.loads(stdout.replace("}\n{", ", "))
-                    except ValueError:
-                        pass
+
             if json_out is None:
                 log.debug("%s failed to load JSON from the following output:\n%r", self, stdout)
         if (
@@ -345,10 +344,8 @@ def process_output(self, stdout, stderr, cmdline=None):
             and self._minion_tgt
             and self._minion_tgt != "*"
         ):
-            try:
+            with contextlib.suppress(KeyError):
                 json_out = json_out[self._minion_tgt]
-            except KeyError:  # pragma: no cover
-                pass
         return stdout, stderr, json_out
 
 
@@ -420,6 +417,7 @@ def pid(self):
         """
         if self.is_running():
             return self._process.pid
+        return None
 
     def start(self, *extra_cli_arguments, max_start_attempts=None, start_timeout=None):
         """
@@ -470,10 +468,8 @@ def _terminate(self):
                 self._process.wait()
             except psutil.TimeoutExpired:
                 self._process.terminate()
-                try:
+                with contextlib.suppress(psutil.TimeoutExpired):
                     self._process.wait()
-                except psutil.TimeoutExpired:
-                    pass
 
         exitcode = self._process.wait() or 0
 
@@ -532,11 +528,9 @@ def __attrs_post_init__(self):
         SaltMixin.__attrs_post_init__(self)
 
         if self.system_service is True and self.extra_cli_arguments_after_first_start_failure:
-            raise pytest.UsageError(
-                "You cannot pass `extra_cli_arguments_after_first_start_failure` to a salt "
-                "system installation setup."
-            )
-        elif self.system_service is False:
+            msg = "You cannot pass `extra_cli_arguments_after_first_start_failure` to a salt system installation setup."
+            raise pytest.UsageError(msg)
+        if self.system_service is False:
             for arg in self.extra_cli_arguments_after_first_start_failure:
                 if arg in ("-l", "--log-level"):
                     break
@@ -563,7 +557,7 @@ def configure(
         root_dir=None,
         defaults=None,
         overrides=None,
-        **configure_kwargs
+        **configure_kwargs,
     ):
         """
         Configure the salt daemon.
@@ -574,7 +568,7 @@ def configure(
             root_dir=root_dir,
             defaults=defaults,
             overrides=overrides,
-            **configure_kwargs
+            **configure_kwargs,
         )
 
     @classmethod
@@ -664,7 +658,7 @@ def cmdline(self, *args):
             if arg in ("-c", "--config-dir"):
                 break
         else:
-            _args.append("--config-dir={}".format(self.config_dir))
+            _args.append(f"--config-dir={self.config_dir}")
         # Handle the logging flag
         for arg in args:
             if not isinstance(arg, str):
@@ -677,9 +671,8 @@ def cmdline(self, *args):
             # Default to being almost quiet on console output
             _args.append("--log-level=critical")
         cmdline = super().cmdline(*(_args + list(args)))
-        if self.python_executable:
-            if cmdline[0] != self.python_executable:
-                cmdline.insert(0, self.python_executable)
+        if self.python_executable and cmdline[0] != self.python_executable:
+            cmdline.insert(0, self.python_executable)
         return cmdline
 
     def _set_started_at(self):
@@ -705,7 +698,8 @@ def _check_start_events(self, timeout_at):
         checks_start_time = time.time()
         while time.time() <= timeout_at:
             if not self.is_running():
-                raise FactoryNotStarted("{} is no longer running".format(self))
+                msg = f"{self} is no longer running"
+                raise FactoryNotStarted(msg)
             if not check_events:
                 break
             check_events -= {
diff --git a/src/saltfactories/cli/__init__.py b/src/saltfactories/cli/__init__.py
index 43a4e986..8b1a5bb3 100644
--- a/src/saltfactories/cli/__init__.py
+++ b/src/saltfactories/cli/__init__.py
@@ -6,3 +6,14 @@
 from . import salt
 from . import spm
 from . import ssh
+
+__all__ = [
+    "call",
+    "cloud",
+    "cp",
+    "key",
+    "run",
+    "salt",
+    "spm",
+    "ssh",
+]
diff --git a/src/saltfactories/cli/call.py b/src/saltfactories/cli/call.py
index 35c7e29d..8225dceb 100644
--- a/src/saltfactories/cli/call.py
+++ b/src/saltfactories/cli/call.py
@@ -14,11 +14,11 @@ class SaltCall(SaltCli):
 
     __cli_timeout_supported__ = attr.ib(repr=False, init=False, default=True)
 
-    def get_minion_tgt(self, minion_tgt=None):
+    def get_minion_tgt(self, minion_tgt=None):  # noqa: ARG002
         """
         Overridden method because salt-run does not target minions, it runs locally.
         """
-        return None
+        return
 
     def process_output(self, stdout, stderr, cmdline=None):
         """
diff --git a/src/saltfactories/cli/cloud.py b/src/saltfactories/cli/cloud.py
index 62c6c412..e27fb7a0 100644
--- a/src/saltfactories/cli/cloud.py
+++ b/src/saltfactories/cli/cloud.py
@@ -48,7 +48,7 @@ def default_config(root_dir, master_id, defaults=None, overrides=None):
             "log_level_logfile": "debug",
             "pytest-cloud": {
                 "master-id": master_id,
-                "log": {"prefix": "{{cli_name}}({})".format(master_id)},
+                "log": {"prefix": f"{{cli_name}}({master_id})"},
             },
         }
         # Merge in the initial default options with the internal _defaults
@@ -68,7 +68,7 @@ def configure(
         root_dir=None,
         defaults=None,
         overrides=None,
-        **configure_kwargs  # pylint: disable=unused-argument
+        **configure_kwargs,  # pylint: disable=unused-argument
     ):
         """
         Configure the CLI.
diff --git a/src/saltfactories/cli/key.py b/src/saltfactories/cli/key.py
index 66a68879..b5b74c1a 100644
--- a/src/saltfactories/cli/key.py
+++ b/src/saltfactories/cli/key.py
@@ -27,21 +27,13 @@ class SaltKey(SaltCli):
     def _default___cli_log_level_supported__(self):
         from salt.utils.parsers import SaltKeyOptionParser
 
-        try:
-            # Salt >= 3005
-            return "--log-level" in SaltKeyOptionParser._console_log_level_cli_flags
-        except AttributeError:  # pragma: no cover
-            # Salt <= 3004
-            return (
-                SaltKeyOptionParser._skip_console_logging_config_  # pylint: disable=no-member
-                is False
-            )
-
-    def get_minion_tgt(self, minion_tgt=None):
+        return "--log-level" in SaltKeyOptionParser._console_log_level_cli_flags  # noqa: SLF001
+
+    def get_minion_tgt(self, minion_tgt=None):  # noqa: ARG002
         """
         Overridden method because salt-key does not target minions.
         """
-        return None
+        return
 
     def process_output(self, stdout, stderr, cmdline=None):
         """
diff --git a/src/saltfactories/cli/run.py b/src/saltfactories/cli/run.py
index 19dcef6b..f583536b 100644
--- a/src/saltfactories/cli/run.py
+++ b/src/saltfactories/cli/run.py
@@ -17,11 +17,11 @@ class SaltRun(SaltCli):
     def _get_default_timeout(self):
         return self.config.get("timeout")
 
-    def get_minion_tgt(self, minion_tgt=None):
+    def get_minion_tgt(self, minion_tgt=None):  # noqa: ARG002
         """
         Overridden method because salt-run does not target minions.
         """
-        return None
+        return
 
     def process_output(self, stdout, stderr, cmdline=None):
         """
diff --git a/src/saltfactories/cli/salt.py b/src/saltfactories/cli/salt.py
index a29cc7c9..cb2aa11e 100644
--- a/src/saltfactories/cli/salt.py
+++ b/src/saltfactories/cli/salt.py
@@ -24,9 +24,8 @@ def cmdline(self, *args, minion_tgt=None, **kwargs):  # pylint: disable=argument
         """
         skip_raise_exception_args = {"-V", "--version", "--versions-report", "--help"}
         if minion_tgt is None and not set(args).intersection(skip_raise_exception_args):
-            raise pytest.UsageError(
-                "The `minion_tgt` keyword argument is mandatory for the salt CLI factory"
-            )
+            msg = "The `minion_tgt` keyword argument is mandatory for the salt CLI factory"
+            raise pytest.UsageError(msg)
         return super().cmdline(*args, minion_tgt=minion_tgt, **kwargs)
 
     def process_output(self, stdout, stderr, cmdline=None):
diff --git a/src/saltfactories/cli/spm.py b/src/saltfactories/cli/spm.py
index fca14e9a..a06cc00b 100644
--- a/src/saltfactories/cli/spm.py
+++ b/src/saltfactories/cli/spm.py
@@ -23,11 +23,11 @@ class Spm(SaltCli):
 
     __cli_output_supported__ = attr.ib(repr=False, init=False, default=False)
 
-    def get_minion_tgt(self, minion_tgt=None):
+    def get_minion_tgt(self, minion_tgt=None):  # noqa: ARG002
         """
         Overridden method because spm does not target minions.
         """
-        return None
+        return
 
     @staticmethod
     def default_config(root_dir, master_factory, defaults=None, overrides=None):
@@ -61,7 +61,7 @@ def default_config(root_dir, master_factory, defaults=None, overrides=None):
             "spm_log_level_logfile": "debug",
             "pytest-spm": {
                 "master-id": master_factory.id,
-                "log": {"prefix": "{{cli_name}}({})".format(master_factory.id)},
+                "log": {"prefix": f"{{cli_name}}({master_factory.id})"},
             },
         }
         # Merge in the initial default options with the internal _defaults
diff --git a/src/saltfactories/cli/ssh.py b/src/saltfactories/cli/ssh.py
index 47503733..15109214 100644
--- a/src/saltfactories/cli/ssh.py
+++ b/src/saltfactories/cli/ssh.py
@@ -31,11 +31,11 @@ def get_script_args(self):
         """
         script_args = super().get_script_args()
         if self.roster_file:
-            script_args.append("--roster-file={}".format(self.roster_file))
+            script_args.append(f"--roster-file={self.roster_file}")
         if self.client_key:
-            script_args.append("--priv={}".format(self.client_key))
+            script_args.append(f"--priv={self.client_key}")
         if self.ssh_user:
-            script_args.append("--user={}".format(self.ssh_user))
+            script_args.append(f"--user={self.ssh_user}")
         return script_args
 
     def get_minion_tgt(self, minion_tgt=None):
diff --git a/src/saltfactories/client.py b/src/saltfactories/client.py
index b3d0d429..2bd2ecf5 100644
--- a/src/saltfactories/client.py
+++ b/src/saltfactories/client.py
@@ -7,7 +7,6 @@
 import attr
 import pytest
 
-
 log = logging.getLogger(__name__)
 
 
@@ -100,5 +99,5 @@ def _check_state_return(self, ret):
                     "A running state.single was found causing a state lock. "
                     "Job details: '{}'  Killing Job Returned: '{}'".format(job_data, job_kill)
                 )
-                ret.append("[TEST SUITE ENFORCED]{}[/TEST SUITE ENFORCED]".format(msg))
+                ret.append(f"[TEST SUITE ENFORCED]{msg}[/TEST SUITE ENFORCED]")
         return ret
diff --git a/src/saltfactories/daemons/__init__.py b/src/saltfactories/daemons/__init__.py
index d7e8ab36..7577ac6b 100644
--- a/src/saltfactories/daemons/__init__.py
+++ b/src/saltfactories/daemons/__init__.py
@@ -5,3 +5,13 @@
 from . import proxy
 from . import sshd
 from . import syndic
+
+__all__ = [
+    "api",
+    "container",
+    "master",
+    "minion",
+    "proxy",
+    "sshd",
+    "syndic",
+]
diff --git a/src/saltfactories/daemons/api.py b/src/saltfactories/daemons/api.py
index 64bed87c..254fa3ed 100644
--- a/src/saltfactories/daemons/api.py
+++ b/src/saltfactories/daemons/api.py
@@ -22,39 +22,39 @@ def __attrs_post_init__(self):
         elif "rest_tornado" in self.config:
             self.check_ports = [self.config["rest_tornado"]["port"]]
         else:
-            raise pytest.UsageError(
-                "The salt-master configuration for this salt-api instance does not seem to have "
-                "any api properly configured."
+            msg = (
+                "The salt-master configuration for this salt-api instance does not seem to have any "
+                "api properly configured."
             )
+            raise pytest.UsageError(msg)
         super().__attrs_post_init__()
 
     @classmethod
     def _configure(
         cls,
-        factories_manager,
-        daemon_id,
-        root_dir=None,
-        defaults=None,
-        overrides=None,
+        factories_manager,  # noqa: ARG003
+        daemon_id,  # noqa: ARG003
+        root_dir=None,  # noqa: ARG003
+        defaults=None,  # noqa: ARG003
+        overrides=None,  # noqa: ARG003
     ):
-        raise pytest.UsageError(
-            "The salt-api daemon is not configurable. It uses the salt-master config that "
-            "it's attached to."
-        )
+        msg = "The salt-api daemon is not configurable. It uses the salt-master config that it's attached to."
+        raise pytest.UsageError(msg)
 
     @classmethod
-    def _get_verify_config_entries(cls, config):
+    def _get_verify_config_entries(cls, config):  # noqa: ARG003
         return []
 
     @classmethod
-    def load_config(cls, config_file, config):
+    def load_config(cls, config_file, config):  # noqa: ARG003
         """
         Return the loaded configuration.
         """
-        raise pytest.UsageError(
+        msg = (
             "The salt-api daemon does not have it's own config file. It uses the salt-master config that "
             "it's attached to."
         )
+        raise pytest.UsageError(msg)
 
     def get_check_events(self):
         """
diff --git a/src/saltfactories/daemons/container.py b/src/saltfactories/daemons/container.py
index 1578ca1e..d18ce008 100644
--- a/src/saltfactories/daemons/container.py
+++ b/src/saltfactories/daemons/container.py
@@ -6,7 +6,6 @@
 import logging
 import os
 
-import _pytest._version
 import attr
 import pytest
 from pytestshellutils.customtypes import Callback
@@ -16,20 +15,22 @@
 from pytestshellutils.utils import time
 from pytestshellutils.utils.processes import ProcessResult
 
-from saltfactories import bases
 from saltfactories import CODE_ROOT_DIR
+from saltfactories import bases
 from saltfactories.daemons import minion
 from saltfactories.utils import random_string
 
 try:
     import docker
-    from docker.errors import DockerException, APIError, NotFound
+    from docker.errors import APIError
+    from docker.errors import DockerException
+    from docker.errors import NotFound
 
     HAS_DOCKER = True
 except ImportError:  # pragma: no cover
     HAS_DOCKER = False
 
-    class DockerException(Exception):
+    class DockerException(Exception):  # noqa: N818
         """
         Define DockerException to avoid NameError.
         """
@@ -39,7 +40,7 @@ class APIError(Exception):
         Define APIError to avoid NameError.
         """
 
-    class NotFound(Exception):
+    class NotFound(Exception):  # noqa: N818
         """
         Define NotFound to avoid NameError.
         """
@@ -72,8 +73,6 @@ class PyWinTypesError(Exception):
 
 log = logging.getLogger(__name__)
 
-PYTEST_GE_7 = getattr(_pytest._version, "version_tuple", (-1, -1)) >= (7, 0)
-
 
 @attr.s(kw_only=True)
 class Container(BaseFactory):
@@ -196,29 +195,23 @@ def _default_name(self):
 
     @docker_client.default
     def _default_docker_client(self):
-        exc_kwargs = {}
-        if PYTEST_GE_7:
-            exc_kwargs["_use_item_location"] = True
         if not HAS_DOCKER:
             message = "The docker python library was not found installed"
             if self.skip_if_docker_client_not_connectable:
-                raise pytest.skip.Exception(message, **exc_kwargs)
-            else:
-                pytest.fail(message)
+                raise pytest.skip.Exception(message, _use_item_location=True)
+            pytest.fail(message)
         if not HAS_REQUESTS:
             message = "The requests python library was not found installed"
             if self.skip_if_docker_client_not_connectable:
-                raise pytest.skip.Exception(message, **exc_kwargs)
-            else:
-                pytest.fail(message)
+                raise pytest.skip.Exception(message, _use_item_location=True)
+            pytest.fail(message)
         try:
             docker_client = docker.from_env()
         except DockerException as exc:
-            message = "Failed to instantiate the docker client: {}".format(exc)
+            message = f"Failed to instantiate the docker client: {exc}"
             if self.skip_if_docker_client_not_connectable:
-                raise pytest.skip.Exception(message, **exc_kwargs) from exc
-            else:
-                pytest.fail(message)
+                raise pytest.skip.Exception(message, _use_item_location=True) from exc
+            pytest.fail(message)
         else:
             return docker_client
 
@@ -272,7 +265,7 @@ def after_terminate(self, callback, *args, **kwargs):
         :keyword kwargs:
             The keyword arguments to pass to the callback
         """
-        self._after_terminate_callbacks.append((callback, args, kwargs))
+        self._after_terminate_callbacks.append(Callback(func=callback, args=args, kwargs=kwargs))
 
     def container_start_check(self, callback, *args, **kwargs):
         """
@@ -312,10 +305,10 @@ def get_display_name(self):
         Returns a human readable name for the factory.
         """
         if self.display_name is None:
-            self.display_name = "{}(id={!r})".format(self.__class__.__name__, self.name)
+            self.display_name = f"{self.__class__.__name__}(id={self.name!r})"
         return self.display_name
 
-    def start(self, *command, max_start_attempts=None, start_timeout=None):
+    def start(self, *command, max_start_attempts=None, start_timeout=None):  # noqa: PLR0915
         """
         Start the container.
         """
@@ -420,21 +413,20 @@ def start(self, *command, max_start_attempts=None, start_timeout=None):
                         exc,
                         exc_info=True,
                     )
-            # TODO: Add containers to the processes stats?!
+            # TODO(s0undt3dch): Add containers to the processes stats?!
             # if self.factories_manager and self.factories_manager.stats_processes is not None:
             #    self.factories_manager.stats_processes[self.get_display_name()] = psutil.Process(
             #        self.pid
             #    )
             return factory_started
         result = self.terminate()
+        msg = (
+            f"The {self} factory has failed to confirm running status after {current_attempt-1} attempts, "
+            f"which took {time.time() - start_time:.2f} seconds({start_timeout or self.start_timeout:.2f} "
+            "seconds each)"
+        )
         raise FactoryNotStarted(
-            "The {} factory has failed to confirm running status after {} attempts, which "
-            "took {:.2f} seconds({:.2f} seconds each)".format(
-                self,
-                current_attempt - 1,
-                time.time() - start_time,
-                start_timeout or self.start_timeout,
-            ),
+            msg,
             process_result=result,
         )
 
@@ -516,7 +508,7 @@ def get_check_ports(self):
             for container_binding, host_binding in _ports.items():
                 if isinstance(host_binding, int):
                     continue
-                host_binding = self.get_host_port_binding(
+                host_binding = self.get_host_port_binding(  # noqa: PLW2901
                     container_binding, protocol="tcp", ipv6=False
                 )
                 if host_binding:
@@ -527,12 +519,14 @@ def get_host_port_binding(self, port, protocol="tcp", ipv6=False):
         """
         Return the host binding for a port on the container.
 
-        Args:
-            :keyword str protocol: The port protocol. Defaults to ``tcp``.
-            :keyword bool ipv6:
-                If true, return the ipv6 port binding.
+        :param int port:
+            The port.
+        :param str protocol:
+            The port protocol. Defaults to ``tcp``.
+        :param bool ipv6:
+            If true, return the ipv6 port binding.
 
-        Returns:
+        :return:
             int: The matched port binding on the host.
             None: When not port binding was matched.
         """
@@ -542,7 +536,7 @@ def get_host_port_binding(self, port, protocol="tcp", ipv6=False):
         log.debug("Container Ports for %s: %s", self, _ports)
         if not _ports:
             return None
-        container_binding = "{}/{}".format(port, protocol)
+        container_binding = f"{port}/{protocol}"
         if container_binding not in _ports:
             return None
         host_port_bindings = _ports[container_binding]
@@ -557,6 +551,7 @@ def get_host_port_binding(self, port, protocol="tcp", ipv6=False):
                     return int(host_port)
                 continue
             return int(host_port)
+        return None
 
     def get_container_start_check_callbacks(self):
         """
@@ -602,9 +597,9 @@ def client_connectable(docker_client):
         try:
             if not docker_client.ping():
                 return "The docker client failed to get a ping response from the docker daemon"
-            return True
+            return True  #  noqa: TRY300
         except (APIError, RequestsConnectionError, PyWinTypesError) as exc:
-            return "The docker client failed to ping the docker server: {}".format(exc)
+            return f"The docker client failed to ping the docker server: {exc}"
 
     def run_container_start_checks(
         self,
@@ -623,7 +618,8 @@ def run_container_start_checks(
         log.debug("%s is running container start checks", self)
         while time.time() <= timeout_at:
             if not self.is_running():
-                raise FactoryNotStarted("{} is no longer running".format(self))
+                msg = f"{self} is no longer running"
+                raise FactoryNotStarted(msg)
             if not start_check_callbacks:
                 break
             start_check = start_check_callbacks[0]
@@ -667,7 +663,8 @@ def _check_listening_ports(self, timeout_at: float) -> bool:
         check_ports = set(check_ports_mapping.values())
         while time.time() <= timeout_at:
             if not self.is_running():
-                raise FactoryNotStarted("{} is no longer running".format(self))
+                msg = f"{self} is no longer running"
+                raise FactoryNotStarted(msg)
             if not check_ports:
                 break
             check_ports -= ports.get_connectable_ports(check_ports)
@@ -691,12 +688,8 @@ def _check_for_connectable_docker_client(self):
         connectable = Container.client_connectable(self.docker_client)
         if connectable is not True:
             if self.skip_if_docker_client_not_connectable:
-                exc_kwargs = {}
-                if PYTEST_GE_7:
-                    exc_kwargs["_use_item_location"] = True
-                raise pytest.skip.Exception(connectable, **exc_kwargs)
-            else:
-                pytest.fail(connectable)
+                raise pytest.skip.Exception(connectable, _use_item_location=True)
+            pytest.fail(connectable)
 
     def _pull_container(self):
         connectable = Container.client_connectable(self.docker_client)
@@ -707,16 +700,8 @@ def _pull_container(self):
             self.docker_client.images.pull(self.image)
         except APIError as exc:
             if self.skip_on_pull_failure:
-                exc_kwargs = {}
-                if PYTEST_GE_7:
-                    exc_kwargs["_use_item_location"] = True
-                raise pytest.skip.Exception(
-                    "Failed to pull docker image '{}': {}".format(
-                        self.image,
-                        exc,
-                    ),
-                    **exc_kwargs,
-                ) from exc
+                msg = f"Failed to pull docker image '{self.image}': {exc}"
+                raise pytest.skip.Exception(msg, _use_item_location=True) from exc
             raise
 
     def __enter__(self):
@@ -724,11 +709,12 @@ def __enter__(self):
         Use as a context manager.
         """
         if not self.is_running():
-            raise RuntimeError(
-                "Factory not yet started. Perhaps you're after something like:\n\n"
-                "with {}.started() as factory:\n"
-                "    yield factory".format(self.__class__.__name__)
+            msg = (
+                f"Factory not yet started. Perhaps you're after something like:\n\n"
+                f"with {self.__class__.__name__}.started() as factory:\n"
+                "    yield factory"
             )
+            raise RuntimeError(msg)
         return self
 
     def __exit__(self, *_):
@@ -796,7 +782,7 @@ def cmdline(self, *args):
             Additional arguments to use when starting the container
 
         """
-        return ["docker", "exec", "-i", self.name] + super().cmdline(*args)
+        return ["docker", "exec", "-i", self.name, *super().cmdline(*args)]
 
     def start(self, *extra_cli_arguments, max_start_attempts=None, start_timeout=None):
         """
@@ -933,7 +919,7 @@ def started(self, *extra_cli_arguments, max_start_attempts=None, start_timeout=N
         """
         try:
             # Start the container
-            with Container.started(
+            with Container.started(  # noqa: SIM117
                 self,
                 *extra_cli_arguments,
                 max_start_attempts=max_start_attempts,
diff --git a/src/saltfactories/daemons/master.py b/src/saltfactories/daemons/master.py
index 382f4998..50879ab4 100644
--- a/src/saltfactories/daemons/master.py
+++ b/src/saltfactories/daemons/master.py
@@ -49,11 +49,13 @@ def __attrs_post_init__(self):
     def __setup_state_tree(self):  # pylint: disable=unused-private-member
         if "file_roots" in self.config:
             return SaltStateTree(envs=copy.deepcopy(self.config.get("file_roots") or {}))
+        return None
 
     @pillar_tree.default
     def __setup_pillar_tree(self):  # pylint: disable=unused-private-member
         if "pillar_roots" in self.config:
             return SaltPillarTree(envs=copy.deepcopy(self.config.get("pillar_roots") or {}))
+        return None
 
     @classmethod
     def default_config(
@@ -90,7 +92,6 @@ def default_config(
             defaults.setdefault("transport", master_of_masters.config["transport"])
 
         if system_service is True:
-
             conf_dir = root_dir / "etc" / "salt"
             conf_dir.mkdir(parents=True, exist_ok=True)
             conf_file = str(conf_dir / "master")
@@ -144,7 +145,7 @@ def default_config(
                 "max_open_files": 10240,
                 "pytest-master": {
                     "master-id": master_of_masters_id,
-                    "log": {"prefix": "{}(id={!r})".format(cls.__name__, master_id)},
+                    "log": {"prefix": f"{cls.__name__}(id={master_id!r})"},
                 },
             }
         else:
@@ -212,7 +213,7 @@ def default_config(
                 "enable_legacy_startup_events": False,
                 "pytest-master": {
                     "master-id": master_of_masters_id,
-                    "log": {"prefix": "{}(id={!r})".format(cls.__name__, master_id)},
+                    "log": {"prefix": f"{cls.__name__}(id={master_id!r})"},
                 },
             }
         # Merge in the initial default options with the internal _defaults
@@ -272,7 +273,7 @@ def _get_verify_config_entries(cls, config):
         return verify_env_entries
 
     @classmethod
-    def load_config(cls, config_file, config):
+    def load_config(cls, config_file, config):  # noqa: ARG003
         """
         Return the loaded configuration.
         """
@@ -290,7 +291,7 @@ def _on_auth_event(self, payload):
         salt_key_cli = self.salt_key_cli()
         if keystate == "pend":
             ret = salt_key_cli.run("--yes", "--accept", minion_id)
-            assert ret.returncode == 0
+            assert ret.returncode == 0  # noqa: S101
 
     def get_check_events(self):
         """
@@ -343,7 +344,7 @@ def salt_cloud_cli(
         defaults=None,
         overrides=None,
         factory_class=cli.cloud.SaltCloud,
-        **factory_class_kwargs
+        **factory_class_kwargs,
     ):
         """
         Return a salt-cloud CLI instance.
@@ -463,7 +464,7 @@ def salt_ssh_cli(
         target_host=None,
         client_key=None,
         ssh_user=None,
-        **factory_class_kwargs
+        **factory_class_kwargs,
     ):
         """
         Return a `salt-ssh` CLI process for this master instance.
@@ -477,7 +478,7 @@ def salt_ssh_cli(
                 The path to the private ssh key to use to connect
             ssh_user(str):
                 The remote username to connect as
-        """  # noqa: D417
+        """
         script_path = self.factories_manager.get_salt_script_path("salt-ssh")
         return factory_class(
             script_name=script_path,
diff --git a/src/saltfactories/daemons/minion.py b/src/saltfactories/daemons/minion.py
index a079c86c..d80261f4 100644
--- a/src/saltfactories/daemons/minion.py
+++ b/src/saltfactories/daemons/minion.py
@@ -30,11 +30,13 @@ class SaltMinion(SaltDaemon):
     def __setup_state_tree(self):  # pylint: disable=unused-private-member
         if "file_roots" in self.config:
             return SaltStateTree(envs=copy.deepcopy(self.config.get("file_roots") or {}))
+        return None
 
     @pillar_tree.default
     def __setup_pillar_tree(self):  # pylint: disable=unused-private-member
         if "pillar_roots" in self.config:
             return SaltPillarTree(envs=copy.deepcopy(self.config.get("pillar_roots") or {}))
+        return None
 
     @classmethod
     def default_config(
@@ -65,7 +67,6 @@ def default_config(
             defaults.setdefault("transport", master.config["transport"])
 
         if system_service is True:
-
             conf_dir = root_dir / "etc" / "salt"
             conf_dir.mkdir(parents=True, exist_ok=True)
             conf_file = str(conf_dir / "minion")
@@ -107,7 +108,7 @@ def default_config(
                 },
                 "pytest-minion": {
                     "master-id": master_id,
-                    "log": {"prefix": "{}(id={!r})".format(cls.__name__, minion_id)},
+                    "log": {"prefix": f"{cls.__name__}(id={minion_id!r})"},
                 },
             }
         else:
@@ -165,7 +166,7 @@ def default_config(
                 "acceptance_wait_time_max": 5,
                 "pytest-minion": {
                     "master-id": master_id,
-                    "log": {"prefix": "{}(id={!r})".format(cls.__name__, minion_id)},
+                    "log": {"prefix": f"{cls.__name__}(id={minion_id!r})"},
                 },
             }
         # Merge in the initial default options with the internal _defaults
@@ -270,5 +271,5 @@ def salt_call_cli(self, factory_class=cli.call.SaltCall, **factory_class_kwargs)
             config=self.config.copy(),
             system_service=self.factories_manager.system_service,
             python_executable=self.python_executable,
-            **factory_class_kwargs
+            **factory_class_kwargs,
         )
diff --git a/src/saltfactories/daemons/proxy.py b/src/saltfactories/daemons/proxy.py
index 37a13b9d..ee60bb86 100644
--- a/src/saltfactories/daemons/proxy.py
+++ b/src/saltfactories/daemons/proxy.py
@@ -28,7 +28,7 @@ def get_service_name(self):
         Return the systemd service name.
         """
         if self._service_name is None:
-            self._service_name = "{}@{}".format(super().get_service_name(), self.factory.id)
+            self._service_name = f"{super().get_service_name()}@{self.factory.id}"
         return self._service_name
 
 
@@ -52,11 +52,13 @@ def _get_impl_class(self):
     def __setup_state_tree(self):  # pylint: disable=unused-private-member
         if "file_roots" in self.config:
             return SaltStateTree(envs=copy.deepcopy(self.config.get("file_roots") or {}))
+        return None
 
     @pillar_tree.default
     def __setup_pillar_tree(self):  # pylint: disable=unused-private-member
         if "pillar_roots" in self.config:
             return SaltPillarTree(envs=copy.deepcopy(self.config.get("pillar_roots") or {}))
+        return None
 
     @classmethod
     def default_config(
@@ -130,7 +132,7 @@ def default_config(
                 "proxy": {"proxytype": "dummy"},
                 "pytest-minion": {
                     "master-id": master_id,
-                    "log": {"prefix": "{}(id={!r})".format(cls.__name__, proxy_minion_id)},
+                    "log": {"prefix": f"{cls.__name__}(id={proxy_minion_id!r})"},
                 },
             }
         else:
@@ -189,7 +191,7 @@ def default_config(
                 "acceptance_wait_time_max": 5,
                 "pytest-minion": {
                     "master-id": master_id,
-                    "log": {"prefix": "{}(id={!r})".format(cls.__name__, proxy_minion_id)},
+                    "log": {"prefix": f"{cls.__name__}(id={proxy_minion_id!r})"},
                 },
             }
         # Merge in the initial default options with the internal _defaults
@@ -272,7 +274,7 @@ def cmdline(self, *args):
             if arg.startswith("--proxyid"):
                 break
         else:
-            _args.append("--proxyid={}".format(self.id))
+            _args.append(f"--proxyid={self.id}")
         return super().cmdline(*(_args + list(args)))
 
     def get_check_events(self):
@@ -302,8 +304,8 @@ def salt_call_cli(self, factory_class=cli.call.SaltCall, **factory_class_kwargs)
         return factory_class(
             script_name=script_path,
             config=self.config.copy(),
-            base_script_args=["--proxyid={}".format(self.id)],
+            base_script_args=[f"--proxyid={self.id}"],
             system_service=self.factories_manager.system_service,
             python_executable=self.python_executable,
-            **factory_class_kwargs
+            **factory_class_kwargs,
         )
diff --git a/src/saltfactories/daemons/sshd.py b/src/saltfactories/daemons/sshd.py
index cf6e9443..25a87a7e 100644
--- a/src/saltfactories/daemons/sshd.py
+++ b/src/saltfactories/daemons/sshd.py
@@ -6,6 +6,7 @@
 import shutil
 import subprocess
 from datetime import datetime
+from datetime import timezone
 
 import attr
 from pytestshellutils.exceptions import FactoryFailure
@@ -59,7 +60,7 @@ def __attrs_post_init__(self):
 
         # Let's generate the client key
         self.client_key = self._generate_client_ecdsa_key()
-        with open("{}.pub".format(self.client_key), encoding="utf=8") as rfh:
+        with open(f"{self.client_key}.pub", encoding="utf=8") as rfh:
             pubkey = rfh.read().strip()
             log.debug("SSH client pub key: %r", pubkey)
             self.authorized_keys.append(pubkey)
@@ -113,9 +114,9 @@ def _write_config(self):
             for key, value in self.sshd_config.items():
                 if isinstance(value, list):
                     for item in value:
-                        config_lines.append("{} {}\n".format(key, item))
+                        config_lines.append(f"{key} {item}\n")
                     continue
-                config_lines.append("{} {}\n".format(key, value))
+                config_lines.append(f"{key} {value}\n")
 
             # Let's generate the host keys
             if platform.is_fips_enabled() is False:
@@ -123,7 +124,7 @@ def _write_config(self):
             self._generate_server_ecdsa_key()
             self._generate_server_ed25519_key()
             for host_key in pathlib.Path(self.config_dir).glob("ssh_host_*_key"):
-                config_lines.append("HostKey {}\n".format(host_key))
+                config_lines.append(f"HostKey {host_key}\n")
 
             with open(str(sshd_config_file), "w", encoding="utf=8") as wfh:
                 wfh.write("".join(sorted(config_lines)))
@@ -138,7 +139,7 @@ def _write_config(self):
     def _generate_client_ecdsa_key(self):
         key_filename = "client_key"
         key_path_prv = self.config_dir / key_filename
-        key_path_pub = self.config_dir / "{}.pub".format(key_filename)
+        key_path_pub = self.config_dir / f"{key_filename}.pub"
         if key_path_prv.exists() and key_path_pub.exists():
             return key_path_prv
         self._ssh_keygen(key_filename, "ecdsa", "521")
@@ -149,7 +150,7 @@ def _generate_client_ecdsa_key(self):
     def _generate_server_dsa_key(self):
         key_filename = "ssh_host_dsa_key"
         key_path_prv = self.config_dir / key_filename
-        key_path_pub = self.config_dir / "{}.pub".format(key_filename)
+        key_path_pub = self.config_dir / f"{key_filename}.pub"
         if key_path_prv.exists() and key_path_pub.exists():
             return key_path_prv
         self._ssh_keygen(key_filename, "dsa", "1024")
@@ -160,7 +161,7 @@ def _generate_server_dsa_key(self):
     def _generate_server_ecdsa_key(self):
         key_filename = "ssh_host_ecdsa_key"
         key_path_prv = self.config_dir / key_filename
-        key_path_pub = self.config_dir / "{}.pub".format(key_filename)
+        key_path_pub = self.config_dir / f"{key_filename}.pub"
         if key_path_prv.exists() and key_path_pub.exists():
             return key_path_prv
         self._ssh_keygen(key_filename, "ecdsa", "521")
@@ -171,7 +172,7 @@ def _generate_server_ecdsa_key(self):
     def _generate_server_ed25519_key(self):
         key_filename = "ssh_host_ed25519_key"
         key_path_prv = self.config_dir / key_filename
-        key_path_pub = self.config_dir / "{}.pub".format(key_filename)
+        key_path_pub = self.config_dir / f"{key_filename}.pub"
         if key_path_prv.exists() and key_path_pub.exists():
             return key_path_prv
         self._ssh_keygen(key_filename, "ed25519", "521")
@@ -180,12 +181,11 @@ def _generate_server_ed25519_key(self):
         return key_path_prv
 
     def _ssh_keygen(self, key_filename, key_type, bits, comment=None):
-
         if comment is None:
             comment = "{user}@{host}-{date}".format(
                 user=running_username(),
                 host=socket.gethostname(),
-                date=datetime.utcnow().strftime("%Y-%m-%d"),
+                date=datetime.now(tz=timezone.utc).strftime("%Y-%m-%d"),
             )
 
         cmdline = [
@@ -203,12 +203,11 @@ def _ssh_keygen(self, key_filename, key_type, bits, comment=None):
         ]
         try:
             subprocess.run(
-                cmdline,
+                cmdline,  # noqa: S603
                 cwd=str(self.config_dir),
                 check=True,
-                universal_newlines=True,
-                stdout=subprocess.PIPE,
-                stderr=subprocess.PIPE,
+                text=True,
+                capture_output=True,
             )
         except subprocess.CalledProcessError as exc:
             process_result = ProcessResult(
@@ -217,6 +216,5 @@ def _ssh_keygen(self, key_filename, key_type, bits, comment=None):
                 stderr=exc.stderr,
                 returncode=exc.returncode,
             )
-            raise FactoryFailure(
-                "Failed to generate ssh key.", process_result=process_result
-            ) from exc
+            msg = "Failed to generate ssh key."
+            raise FactoryFailure(msg, process_result=process_result) from exc
diff --git a/src/saltfactories/daemons/syndic.py b/src/saltfactories/daemons/syndic.py
index afbd986d..5e018234 100644
--- a/src/saltfactories/daemons/syndic.py
+++ b/src/saltfactories/daemons/syndic.py
@@ -77,7 +77,7 @@ def default_config(
                 "syndic_log_level_logfile": "debug",
                 "pytest-syndic": {
                     "master-id": master_of_masters_id,
-                    "log": {"prefix": "{}(id={!r})".format(cls.__name__, syndic_id)},
+                    "log": {"prefix": f"{cls.__name__}(id={syndic_id!r})"},
                 },
             }
         else:
@@ -101,7 +101,7 @@ def default_config(
                 "enable_legacy_startup_events": False,
                 "pytest-syndic": {
                     "master-id": master_of_masters_id,
-                    "log": {"prefix": "{}(id={!r})".format(cls.__name__, syndic_id)},
+                    "log": {"prefix": f"{cls.__name__}(id={syndic_id!r})"},
                 },
             }
         # Merge in the initial default options with the internal _defaults
@@ -135,13 +135,12 @@ def _configure(  # pylint: disable=arguments-differ
     def _get_verify_config_entries(cls, config):
         # verify env to make sure all required directories are created and have the
         # right permissions
-        verify_env_entries = [
+        return [
             str(pathlib.Path(config["syndic_log_file"]).parent),
         ]
-        return verify_env_entries
 
     @classmethod
-    def load_config(cls, config_file, config):
+    def load_config(cls, config_file, config):  # noqa: ARG003
         """
         Return the loaded configuration.
         """
diff --git a/src/saltfactories/exceptions.py b/src/saltfactories/exceptions.py
index 9be67443..d8ee8697 100644
--- a/src/saltfactories/exceptions.py
+++ b/src/saltfactories/exceptions.py
@@ -6,6 +6,7 @@
 def __getattr__(name):
     if name in ("FactoryTimeout", "FactoryNotStarted"):
         import pytestshellutils.exceptions  # pylint: disable=import-outside-toplevel
+
         from saltfactories.utils import warn_until  # pylint: disable=import-outside-toplevel
 
         warn_until(
@@ -15,5 +16,6 @@ def __getattr__(name):
             "pytest-salt-factories {{version}}.".format(name),
         )
         return getattr(pytestshellutils.exceptions, name)
-    else:
-        raise AttributeError("module '{}' has no '{}' attribute".format(__name__, name))
+
+    msg = f"module '{__name__}' has no '{name}' attribute"
+    raise AttributeError(msg)
diff --git a/src/saltfactories/manager.py b/src/saltfactories/manager.py
index c4736313..1155fd9e 100644
--- a/src/saltfactories/manager.py
+++ b/src/saltfactories/manager.py
@@ -162,10 +162,14 @@ def final_minion_config_tweaks(self, config):
         pytest_key = "pytest-minion"
         if pytest_key not in config:  # pragma: no cover
             config[pytest_key] = {}
-        config[pytest_key]["returner_address"] = {
-            "host": self.event_listener.host,
-            "port": self.event_listener.port,
-        }
+        if "returner_address" not in config[pytest_key]:
+            config[pytest_key]["returner_address"] = {}
+        returner_address_config = config[pytest_key]["returner_address"]
+        event_listener_host = self.event_listener.host
+        if event_listener_host == "0.0.0.0":  # noqa: S104
+            event_listener_host = "127.0.0.1"
+        returner_address_config.setdefault("host", event_listener_host)
+        returner_address_config.setdefault("port", self.event_listener.port)
         self.final_common_config_tweaks(config, "minion")
 
     def final_master_config_tweaks(self, config):
@@ -175,10 +179,14 @@ def final_master_config_tweaks(self, config):
         pytest_key = "pytest-master"
         if pytest_key not in config:  # pragma: no cover
             config[pytest_key] = {}
-        config[pytest_key]["returner_address"] = {
-            "host": self.event_listener.host,
-            "port": self.event_listener.port,
-        }
+        if "returner_address" not in config[pytest_key]:
+            config[pytest_key]["returner_address"] = {}
+        returner_address_config = config[pytest_key]["returner_address"]
+        event_listener_host = self.event_listener.host
+        if event_listener_host == "0.0.0.0":  # noqa: S104
+            event_listener_host = "127.0.0.1"
+        returner_address_config.setdefault("host", event_listener_host)
+        returner_address_config.setdefault("port", self.event_listener.port)
         self.final_common_config_tweaks(config, "master")
 
     def final_syndic_config_tweaks(self, config):
@@ -213,26 +221,19 @@ def final_common_config_tweaks(self, config, role):
         if "pytest" not in config["engines"]:
             config["engines"].append("pytest")
 
-        if self.generate_scripts is False or self.system_service is True:
-            # This means that the salt being imported and used by salt-factories
-            # might not be the same as the one being tested.
-            # So, in this case, make sure events and logging from started daemons
-            # still gets forwarded to salt-factories.
-            if "engines_dirs" not in config:
-                config["engines_dirs"] = []
-            config["engines_dirs"].insert(0, str(FactoriesManager.get_salt_engines_path()))
-            if "log_handlers_dirs" not in config:
-                config["log_handlers_dirs"] = []
-            config["log_handlers_dirs"].insert(
-                0, str(FactoriesManager.get_salt_log_handlers_path())
-            )
+        if "engines_dirs" not in config:
+            config["engines_dirs"] = []
+        config["engines_dirs"].insert(0, str(FactoriesManager.get_salt_engines_path()))
+        if "log_handlers_dirs" not in config:
+            config["log_handlers_dirs"] = []
+        config["log_handlers_dirs"].insert(0, str(FactoriesManager.get_salt_log_handlers_path()))
 
         config.setdefault("user", running_username())
         if not config["user"]:  # pragma: no cover
             # If this value is empty, None, False, just remove it
             config.pop("user")
 
-        pytest_key = "pytest-{}".format(role)
+        pytest_key = f"pytest-{role}"
         if pytest_key not in config:
             config[pytest_key] = {}
 
@@ -255,7 +256,7 @@ def salt_master_daemon(
         max_start_attempts=3,
         start_timeout=None,
         factory_class=daemons.master.SaltMaster,
-        **factory_class_kwargs
+        **factory_class_kwargs,
     ):
         """
         Return a salt-master instance.
@@ -304,7 +305,7 @@ def salt_master_daemon(
             factory_class,
             max_start_attempts,
             start_timeout,
-            **factory_class_kwargs
+            **factory_class_kwargs,
         )
 
     def salt_minion_daemon(
@@ -316,7 +317,7 @@ def salt_minion_daemon(
         max_start_attempts=3,
         start_timeout=None,
         factory_class=daemons.minion.SaltMinion,
-        **factory_class_kwargs
+        **factory_class_kwargs,
     ):
         """
         Return a salt-minion instance.
@@ -362,7 +363,7 @@ def salt_minion_daemon(
             factory_class,
             max_start_attempts,
             start_timeout,
-            **factory_class_kwargs
+            **factory_class_kwargs,
         )
 
     def salt_syndic_daemon(
@@ -380,7 +381,7 @@ def salt_syndic_daemon(
         minion_defaults=None,
         minion_overrides=None,
         minion_factory_class=daemons.minion.SaltMinion,
-        **factory_class_kwargs
+        **factory_class_kwargs,
     ):
         """
         Return a salt-syndic instance.
@@ -473,7 +474,7 @@ def salt_syndic_daemon(
             start_timeout=start_timeout,
             master=master_factory,
             minion=minion_factory,
-            **factory_class_kwargs
+            **factory_class_kwargs,
         )
 
         # We need the syndic master and minion running
@@ -490,7 +491,7 @@ def salt_proxy_minion_daemon(
         max_start_attempts=3,
         start_timeout=None,
         factory_class=daemons.proxy.SaltProxyMinion,
-        **factory_class_kwargs
+        **factory_class_kwargs,
     ):
         """
         Return a salt proxy-minion instance.
@@ -537,7 +538,7 @@ def salt_proxy_minion_daemon(
             factory_class,
             max_start_attempts,
             start_timeout,
-            **factory_class_kwargs
+            **factory_class_kwargs,
         )
 
     def salt_api_daemon(
@@ -546,7 +547,7 @@ def salt_api_daemon(
         max_start_attempts=3,
         start_timeout=None,
         factory_class=daemons.api.SaltApi,
-        **factory_class_kwargs
+        **factory_class_kwargs,
     ):
         """
         Return a salt-api instance.
@@ -564,7 +565,7 @@ def salt_api_daemon(
             factory_class,
             max_start_attempts=max_start_attempts,
             start_timeout=start_timeout,
-            **factory_class_kwargs
+            **factory_class_kwargs,
         )
 
     def get_sshd_daemon(
@@ -578,7 +579,7 @@ def get_sshd_daemon(
         max_start_attempts=3,
         start_timeout=None,
         factory_class=daemons.sshd.Sshd,
-        **factory_class_kwargs
+        **factory_class_kwargs,
     ):
         """
         Return an SSHD daemon instance.
@@ -624,7 +625,7 @@ def get_sshd_daemon(
             listen_address=listen_address,
             listen_port=listen_port,
             sshd_config_dict=sshd_config_dict,
-            **factory_class_kwargs
+            **factory_class_kwargs,
         )
 
     def get_container(
@@ -635,7 +636,7 @@ def get_container(
         factory_class=daemons.container.Container,
         max_start_attempts=3,
         start_timeout=None,
-        **factory_class_kwargs
+        **factory_class_kwargs,
     ):
         """
         Return a container instance.
@@ -669,7 +670,7 @@ def get_container(
             cwd=self.cwd,
             start_timeout=start_timeout or self.start_timeout,
             max_start_attempts=max_start_attempts,
-            **factory_class_kwargs
+            **factory_class_kwargs,
         )
 
     def get_salt_script_path(self, script_name):
@@ -688,13 +689,13 @@ def get_salt_script_path(self, script_name):
         if self.system_service:
             script_path = shutil.which(script_name)
             if not script_path:
-                raise FileNotFoundError(
-                    "Salt CLI script '{}' was not found in $PATH".format(script_name)
-                )
+                msg = f"Salt CLI script '{script_name}' was not found in $PATH"
+                raise FileNotFoundError(msg)
             return script_path
         script_path = self.scripts_dir / script_name
         if not script_path.exists():
-            raise FileNotFoundError("Salt CLI script '{}' not found".format(script_path))
+            msg = f"Salt CLI script '{script_path}' not found"
+            raise FileNotFoundError(msg)
         return str(script_path)
 
     def _get_factory_class_instance(
@@ -704,13 +705,13 @@ def _get_factory_class_instance(
         factory_class,
         max_start_attempts,
         start_timeout,
-        **factory_class_kwargs
+        **factory_class_kwargs,
     ):
         """
         Helper method to instantiate daemon factories.
         """
         script_path = self.get_salt_script_path(script_name)
-        factory = factory_class(
+        return factory_class(
             config=daemon_config,
             start_timeout=start_timeout or self.start_timeout,
             slow_stop=self.slow_stop,
@@ -722,9 +723,8 @@ def _get_factory_class_instance(
             script_name=script_path,
             system_service=self.system_service,
             python_executable=self.python_executable,
-            **factory_class_kwargs
+            **factory_class_kwargs,
         )
-        return factory
 
     def get_root_dir_for_daemon(self, daemon_id, defaults=None, factory_class=None):
         """
@@ -739,7 +739,7 @@ def get_root_dir_for_daemon(self, daemon_id, defaults=None, factory_class=None):
             return root_dir
         if self.system_service is True and issubclass(factory_class, SaltMixin):
             return self.root_dir
-        elif self.system_service is True:
+        if self.system_service is True:
             root_dir = self.tmp_root_dir
         else:
             root_dir = self.root_dir
@@ -748,7 +748,7 @@ def get_root_dir_for_daemon(self, daemon_id, defaults=None, factory_class=None):
         while True:
             if not root_dir.is_dir():
                 break
-            root_dir = self.root_dir / "{}_{}".format(daemon_id, counter)
+            root_dir = self.root_dir / f"{daemon_id}_{counter}"
             counter += 1
         root_dir.mkdir(parents=True, exist_ok=True)
         return root_dir
diff --git a/src/saltfactories/plugins/__init__.py b/src/saltfactories/plugins/__init__.py
index 315f248a..f00b2b9e 100644
--- a/src/saltfactories/plugins/__init__.py
+++ b/src/saltfactories/plugins/__init__.py
@@ -24,7 +24,7 @@ def pytest_tempdir_temproot():
     if pytestskipmarkers.utils.platform.is_windows():
         tempdir = "C:/Windows/Temp"
     elif pytestskipmarkers.utils.platform.is_darwin():
-        tempdir = "/tmp"
+        tempdir = "/tmp"  # noqa: S108
     else:
         tempdir = os.environ.get("TMPDIR") or tempfile.gettempdir()
     return os.path.abspath(os.path.realpath(tempdir))
@@ -84,8 +84,9 @@ def pytest_load_initial_conftests(*_):
     # onedir build in salt's repo checkout.
     import salt.version  # pylint: disable=import-outside-toplevel
 
-    if salt.version.__saltstack_version__ < "3004":
-        raise pytest.UsageError("Only salt>=3004 is supported")
+    if salt.version.__saltstack_version__ < "3005":
+        msg = f"Only salt>=3005 is supported(Installed version {salt.version.__saltstack_version__}"
+        raise pytest.UsageError(msg)
     if "temp_directory" not in pytest.helpers:
         pytest.helpers.register(saltfactories.utils.tempfiles.temp_directory, name="temp_directory")
     if "temp_file" not in pytest.helpers:
diff --git a/src/saltfactories/plugins/event_listener.py b/src/saltfactories/plugins/event_listener.py
index 910ada62..5906d9a0 100644
--- a/src/saltfactories/plugins/event_listener.py
+++ b/src/saltfactories/plugins/event_listener.py
@@ -12,23 +12,24 @@
 from collections import deque
 from datetime import datetime
 from datetime import timedelta
+from datetime import timezone
 
 import attr
 import msgpack.exceptions
 import pytest
 from pytestshellutils.utils import ports
 from pytestshellutils.utils import time
-
+from pytestskipmarkers.utils import platform
 
 log = logging.getLogger(__name__)
 
 
 def _convert_stamp(stamp):
     try:
-        return datetime.fromisoformat(stamp)
+        return datetime.fromisoformat(stamp).replace(tzinfo=timezone.utc)
     except AttributeError:  # pragma: no cover
         # Python < 3.7
-        return datetime.strptime(stamp, "%Y-%m-%dT%H:%M:%S.%f")
+        return datetime.strptime(stamp, "%Y-%m-%dT%H:%M:%S.%f").replace(tzinfo=timezone.utc)
 
 
 @attr.s(kw_only=True, slots=True, hash=True, frozen=True)
@@ -71,7 +72,7 @@ def expired(self):
         """
         Property to identify if the event has expired, at which time it should be removed from the store.
         """
-        if datetime.utcnow() < self._expire_at:
+        if datetime.now(tz=timezone.utc) < self._expire_at:
             return False
         return True
 
@@ -121,7 +122,7 @@ class EventListenerServer(asyncio.Protocol):
     TCP Server to receive events forwarded.
     """
 
-    def __init__(self, _event_listener, *args, **kwargs):
+    def __init__(self, _event_listener, *args, **kwargs) -> None:
         self._event_listener = _event_listener
         super().__init__(*args, **kwargs)
 
@@ -133,7 +134,7 @@ def connection_made(self, transport):
         log.debug("Connection from %s", peername)
         # pylint: disable=attribute-defined-outside-init
         self.transport = transport
-        self.unpacker = msgpack.Unpacker(raw=False)
+        self.unpacker = msgpack.Unpacker(raw=False, strict_map_key=False)
         # pylint: enable=attribute-defined-outside-init
 
     def data_received(self, data):
@@ -145,14 +146,15 @@ def data_received(self, data):
         except msgpack.exceptions.BufferFull:
             # Start over loosing some data?!
             self.unpacker = msgpack.Unpacker(  # pylint: disable=attribute-defined-outside-init
-                raw=False
+                raw=False,
+                strict_map_key=False,
             )
             self.unpacker.feed(data)
         for payload in self.unpacker:
             if payload is None:
                 self.transport.close()
                 break
-            self._event_listener._process_event_payload(payload)
+            self._event_listener._process_event_payload(payload)  # noqa: SLF001
 
 
 @attr.s(kw_only=True, slots=True, hash=False)
@@ -179,14 +181,26 @@ class EventListener:
     server = attr.ib(init=False, repr=False, hash=False)
     server_running_event = attr.ib(init=False, repr=False, hash=False)
 
+    @host.default
+    def _default_host(self):
+        if platform.is_windows():
+            # Windows cannot bind to 0.0.0.0
+            return "127.0.0.1"
+        return "0.0.0.0"  # noqa: S104
+
+    @port.default
+    def _default_port(self):
+        return ports.get_unused_localhost_port()
+
+    @address.default
+    def _default_address(self):
+        return f"tcp://{self.host}:{self.port}"
+
     def __attrs_post_init__(self):
         """
         Post attrs initialization routines.
         """
         self.store = deque(maxlen=10000)
-        self.host = "127.0.0.1"
-        self.port = ports.get_unused_localhost_port()
-        self.address = f"tcp://{self.host}:{self.port}"
         self.running_event = threading.Event()
         self.cleanup_thread = threading.Thread(target=self._cleanup)
         self.auth_event_handlers = weakref.WeakValueDictionary()
@@ -205,7 +219,9 @@ def start_server(self):
             # the server crash. Let's join the thread to restart it all.
             self.running_thread.join()
             self.running_thread = None
-        log.info("%s server is re-starting", self)
+            log.info("%s server is re-starting", self)
+        else:
+            log.info("%s server is starting", self)
         self.running_thread = threading.Thread(target=self._run_loop_in_thread)
         self.running_thread.start()
 
@@ -214,9 +230,9 @@ def _run_loop_in_thread(self):
         asyncio.set_event_loop(loop)
         try:
             loop.run_until_complete(self._run_server())
-        except Exception as exc:
+        except Exception:  # pylint: disable=broad-except
             self.server_running_event.clear()
-            raise exc from None
+            log.exception("%s: Exception raised while the running the server", self)
         finally:
             log.debug("shutdown asyncgens")
             loop.run_until_complete(loop.shutdown_asyncgens())
@@ -277,13 +293,11 @@ def _process_event_payload(self, decoded):
                 if auth_event_callback:
                     try:
                         auth_event_callback(data)
-                    except Exception as exc:  # pragma: no cover pylint: disable=broad-except
-                        log.error(
-                            "%s Error calling %r: %s",
+                    except Exception:  # pragma: no cover pylint: disable=broad-except
+                        log.exception(
+                            "%s Error calling %r",
                             self,
                             auth_event_callback,
-                            exc,
-                            exc_info=True,
                         )
             log.debug(
                 "%s store(id: %s) size after event received: %d",
@@ -292,7 +306,7 @@ def _process_event_payload(self, decoded):
                 len(self.store),
             )
         except Exception:  # pragma: no cover pylint: disable=broad-except
-            log.error("%s Something funky happened", self, exc_info=True)
+            log.exception("%s Something funky happened", self)
 
     def _cleanup(self):
         cleanup_at = time.time() + 30
@@ -340,7 +354,8 @@ def start(self):
         # Wait for the thread to start
         if self.server_running_event.wait(5) is not True:
             self.server_running_event.clear()
-            raise RuntimeError("Failed to start the event listener")
+            msg = "Failed to start the event listener"
+            raise RuntimeError(msg)
         log.debug("%s is started", self)
         self.cleanup_thread.start()
 
@@ -390,9 +405,9 @@ def get_events(self, patterns, after_time=None):
         :return set: A set of matched events
         """
         if after_time is None:
-            after_time = datetime.utcnow()
+            after_time = datetime.now(tz=timezone.utc)
         elif isinstance(after_time, float):
-            after_time = datetime.utcfromtimestamp(after_time)
+            after_time = datetime.fromtimestamp(after_time, tz=timezone.utc)
         after_time_iso = after_time.isoformat()
         log.debug(
             "%s is checking for event patterns happening after %s: %s",
@@ -448,9 +463,9 @@ def wait_for_events(self, patterns, timeout=30, after_time=None):
         :rtype ~saltfactories.plugins.event_listener.MatchedEvents:
         """
         if after_time is None:
-            after_time = datetime.utcnow()
+            after_time = datetime.now(tz=timezone.utc)
         elif isinstance(after_time, float):
-            after_time = datetime.utcfromtimestamp(after_time)
+            after_time = datetime.fromtimestamp(after_time, tz=timezone.utc)
         after_time_iso = after_time.isoformat()
         log.debug(
             "%s is waiting for event patterns happening after %s: %s",
@@ -554,7 +569,7 @@ def test_send(event_listener, salt_master, salt_minion, salt_call_cli):
 
 
 @pytest.fixture(autouse=True)
-def restart_event_listener(event_listener):  # pylint: disable=redefined-outer-name
+def _restart_event_listener(event_listener):  # pylint: disable=redefined-outer-name
     """
     Restart the `event_listener` TCP server is case it crashed.
     """
diff --git a/src/saltfactories/plugins/factories.py b/src/saltfactories/plugins/factories.py
index e1dee94b..108afc48 100644
--- a/src/saltfactories/plugins/factories.py
+++ b/src/saltfactories/plugins/factories.py
@@ -14,7 +14,7 @@
 
 
 @pytest.fixture(scope="session")
-def _salt_factories_config(request):
+def _salt_factories_config(request):  # noqa: PT005
     """
     Return a dictionary with the keyword arguments for FactoriesManager.
     """
@@ -60,7 +60,8 @@ def salt_factories(
     from saltfactories.manager import FactoriesManager  # pylint: disable=import-outside-toplevel
 
     if not isinstance(salt_factories_config, dict):
-        raise pytest.UsageError("The 'salt_factories_config' fixture MUST return a dictionary")
+        msg = "The 'salt_factories_config' fixture MUST return a dictionary"
+        raise pytest.UsageError(msg)
     if salt_factories_config:
         log.debug(
             "Salt Factories Manager Default Config:\n%s", pprint.pformat(_salt_factories_config)
diff --git a/src/saltfactories/plugins/loader.py b/src/saltfactories/plugins/loader.py
index adc203cc..b80e4204 100644
--- a/src/saltfactories/plugins/loader.py
+++ b/src/saltfactories/plugins/loader.py
@@ -32,10 +32,11 @@ def pytest_collection_modifyitems(items):
                 fixture = getattr(item.module, typo)
                 try:
                     fixture._pytestfixturefunction  # pylint: disable=pointless-statement
-                    raise RuntimeError(
-                        "The module {} defines a '{}' fixture but the correct fixture name "
-                        "is 'configure_loader_modules'".format(item.module, typo)
+                    msg = (
+                        f"The module {item.module} defines a '{typo}' fixture but the correct fixture "
+                        "name is 'configure_loader_modules'"
                     )
+                    raise RuntimeError(msg)
                 except AttributeError:
                     # It's a regular function?!
                     # Carry on
@@ -55,10 +56,11 @@ def pytest_collection_modifyitems(items):
                 fixture._pytestfixturefunction
             except AttributeError:
                 # It's not a fixture, raise an error
-                raise RuntimeError(
-                    "The module {} defines a 'configure_loader_modules' function but "
-                    "that function is not a fixture".format(item.module)
-                ) from None
+                msg = (
+                    f"The module {item.module} defines a 'configure_loader_modules' function but "
+                    "that function is not a fixture"
+                )
+                raise RuntimeError(msg) from None
 
 
 @pytest.fixture(autouse=True)
diff --git a/src/saltfactories/plugins/log_server.py b/src/saltfactories/plugins/log_server.py
index 22694262..7697ab81 100644
--- a/src/saltfactories/plugins/log_server.py
+++ b/src/saltfactories/plugins/log_server.py
@@ -56,7 +56,7 @@ def _default_log_host(self):
         if platform.is_windows():
             # Windows cannot bind to 0.0.0.0
             return "127.0.0.1"
-        return "0.0.0.0"
+        return "0.0.0.0"  # noqa: S104
 
     @log_port.default
     def _default_log_port(self):
@@ -79,7 +79,8 @@ def start(self):
         # Wait for the thread to start
         if self.running_event.wait(5) is not True:  # pragma: no cover
             self.running_event.clear()
-            raise RuntimeError("Failed to start the log server")
+            msg = "Failed to start the log server"
+            raise RuntimeError(msg)
         log.info("%s started", self)
 
     def stop(self):
@@ -87,7 +88,7 @@ def stop(self):
         Stop the log server.
         """
         log.info("%s stopping...", self)
-        address = "tcp://{}:{}".format(self.log_host, self.log_port)
+        address = f"tcp://{self.log_host}:{self.log_port}"
         context = zmq.Context()
         sender = context.socket(zmq.PUSH)  # pylint: disable=no-member
         sender.connect(address)
@@ -119,20 +120,20 @@ def stop(self):
             else:
                 log.warning("%s The logging server thread is still running...", self)
 
-    def process_logs(self):
+    def process_logs(self):  # noqa: PLR0915
         """
         Process the logs returned.
         """
-        address = "tcp://{}:{}".format(self.log_host, self.log_port)
+        address = f"tcp://{self.log_host}:{self.log_port}"
         context = zmq.Context()
         puller = context.socket(zmq.PULL)  # pylint: disable=no-member
         puller.set_hwm(self.socket_hwm)
         exit_timeout_seconds = 5
         exit_timeout = None
         if msgpack.version >= (0, 5, 2):
-            msgpack_kwargs = dict(raw=False)
+            msgpack_kwargs = {"raw": False}
         else:  # pragma: no cover
-            msgpack_kwargs = dict(encoding="utf-8")
+            msgpack_kwargs = {"encoding": "utf-8"}
         try:
             puller.bind(address)
         except zmq.ZMQError:  # pragma: no cover
@@ -176,10 +177,10 @@ def process_logs(self):
                         for key, value in record_dict.copy().items():
                             skip_update = True
                             if isinstance(value, bytes):
-                                value = value.decode("utf-8")
+                                value = value.decode("utf-8")  # noqa: PLW2901
                                 skip_update = False
                             if isinstance(key, bytes):
-                                key = key.decode("utf-8")
+                                key = key.decode("utf-8")  # noqa: PLW2901
                                 skip_update = False
                             if skip_update is False:
                                 record_dict[key] = value
diff --git a/src/saltfactories/plugins/markers.py b/src/saltfactories/plugins/markers.py
index ffa7a9c4..49082517 100644
--- a/src/saltfactories/plugins/markers.py
+++ b/src/saltfactories/plugins/markers.py
@@ -56,7 +56,7 @@ def session_markers_loader(salt_factories):
     )
     loader_instance = saltfactories.utils.functional.Loaders(
         factory.config.copy(),
-        loaded_base_name="{}.loaded".format(__name__),
+        loaded_base_name=f"{__name__}.loaded",
     )
     # Sync Everything
     loader_instance.modules.saltutil.sync_all()
diff --git a/src/saltfactories/plugins/sysinfo.py b/src/saltfactories/plugins/sysinfo.py
index 5a155b9e..22a29bc9 100644
--- a/src/saltfactories/plugins/sysinfo.py
+++ b/src/saltfactories/plugins/sysinfo.py
@@ -132,9 +132,7 @@ def pytest_sessionstart(session):
         terminal_reporter.section("System Information", sep=">")
         terminal_reporter.section("Salt Versions Report", sep="-", bold=True)
         terminal_reporter.write(
-            "\n".join(
-                "  {}".format(line.rstrip()) for line in salt.version.versions_report()
-            ).rstrip()
+            "\n".join(f"  {line.rstrip()}" for line in salt.version.versions_report()).rstrip()
             + "\n"
         )
         terminal_reporter.ensure_newline()
@@ -162,7 +160,7 @@ def pytest_sessionstart(session):
         terminal_reporter.section("System Grains Report", sep="-")
         terminal_reporter.write(
             "\n".join(
-                "  {}".format(line.rstrip()) for line in grains_output_file.read().splitlines()
+                f"  {line.rstrip()}" for line in grains_output_file.read().splitlines()
             ).rstrip()
             + "\n"
         )
diff --git a/src/saltfactories/utils/__init__.py b/src/saltfactories/utils/__init__.py
index dba4d719..6efc02f0 100644
--- a/src/saltfactories/utils/__init__.py
+++ b/src/saltfactories/utils/__init__.py
@@ -28,7 +28,8 @@ def random_string(prefix, size=6, uppercase=True, lowercase=True, digits=True):
     :return str: The random string
     """
     if not any([uppercase, lowercase, digits]):
-        raise RuntimeError("At least one of 'uppercase', 'lowercase' or 'digits' needs to be true")
+        msg = "At least one of 'uppercase', 'lowercase' or 'digits' needs to be true"
+        raise RuntimeError(msg)
     choices = []
     if uppercase:
         choices.extend(string.ascii_uppercase)
@@ -37,7 +38,7 @@ def random_string(prefix, size=6, uppercase=True, lowercase=True, digits=True):
     if digits:
         choices.extend(string.digits)
 
-    return prefix + "".join(random.choice(choices) for _ in range(size))
+    return prefix + "".join(random.choice(choices) for _ in range(size))  # noqa: S311
 
 
 @lru_cache(maxsize=1)
@@ -69,10 +70,10 @@ def cast_to_pathlib_path(value):
 def warn_until(
     version: str,
     message: str,
-    category: Type[Warning] = DeprecationWarning,
-    stacklevel: Optional[int] = None,
+    category: Type[Warning] = DeprecationWarning,  # noqa: FA100
+    stacklevel: Optional[int] = None,  # noqa: FA100
     _dont_call_warnings: bool = False,
-    _pkg_version_: Optional[str] = None,
+    _pkg_version_: Optional[str] = None,  # noqa: FA100
 ) -> None:
     """
     Show a deprecation warning.
@@ -106,7 +107,7 @@ def warn_until(
         stacklevel = 3
 
     _pytest_is_rewriting = False
-    caller = inspect.getframeinfo(sys._getframe(stacklevel - 1))
+    caller = inspect.getframeinfo(sys._getframe(stacklevel - 1))  # noqa: SLF001
     caller_filename = pathlib.Path(caller.filename)
 
     if str(caller_filename.as_posix()).endswith("/_pytest/assertion/rewrite.py"):
@@ -118,18 +119,13 @@ def warn_until(
     if _pkg_version >= _version:
         if _pytest_is_rewriting:
             # We need to grab the caller with the new stack level
-            caller = inspect.getframeinfo(sys._getframe(stacklevel - 1))
-        raise RuntimeError(
-            "The warning triggered on filename '{filename}', line number "
-            "{lineno}, is supposed to be shown until version "
-            "{until_version} is released. Current version is now "
-            "{version}. Please remove the warning.".format(
-                filename=caller.filename,
-                lineno=caller.lineno,
-                until_version=_pkg_version_,
-                version=version,
-            ),
+            caller = inspect.getframeinfo(sys._getframe(stacklevel - 1))  # noqa: SLF001
+        msg = (
+            f"The warning triggered on filename '{caller.filename}', line number {caller.lineno}, "
+            f"is supposed to be shown until version {_pkg_version_} is released. Current version "
+            f"is now {version}. Please remove the warning."
         )
+        raise RuntimeError(msg)
 
     if _dont_call_warnings is False:
         warnings.warn(
diff --git a/src/saltfactories/utils/cli_scripts.py b/src/saltfactories/utils/cli_scripts.py
index ccc7f628..2bc7b435 100644
--- a/src/saltfactories/utils/cli_scripts.py
+++ b/src/saltfactories/utils/cli_scripts.py
@@ -200,13 +200,11 @@ def generate_script(
             if code_dir:
                 script_contents += (
                     textwrap.dedent(
-                        """
+                        f"""
                     CODE_DIR = r'{code_dir}'
                     if CODE_DIR in sys.path:
                         sys.path.remove(CODE_DIR)
-                    sys.path.insert(0, CODE_DIR)""".format(
-                            code_dir=code_dir
-                        )
+                    sys.path.insert(0, CODE_DIR)"""
                     ).strip()
                     + "\n\n"
                 )
@@ -221,10 +219,8 @@ def generate_script(
                     + "\n\n"
                 )
             elif not all([coverage_rc_path is None, coverage_db_path is None]):
-                raise pytest.UsageError(
-                    "To track code coverage, both 'coverage_db_path' and "
-                    "'coverage_rc_path' must be passed."
-                )
+                msg = "To track code coverage, both 'coverage_db_path' and 'coverage_rc_path' must be passed."
+                raise pytest.UsageError(msg)
 
             if inject_sitecustomize:
                 script_contents += (
diff --git a/src/saltfactories/utils/functional.py b/src/saltfactories/utils/functional.py
index 36e5708e..504593b9 100644
--- a/src/saltfactories/utils/functional.py
+++ b/src/saltfactories/utils/functional.py
@@ -52,7 +52,7 @@ def reset_loaders_state(loaders):
                 loaders.reset_state()
     """
 
-    def __init__(self, opts, loaded_base_name=None):
+    def __init__(self, opts, loaded_base_name=None) -> None:
         self.opts = opts
         if loaded_base_name is None:
             # Do not move this deferred import. It allows running against a Salt onedir build
@@ -193,7 +193,7 @@ class ModulesLoaderDict(_modules.mod_dict_class):
                 Custom class to implement wrappers.
                 """
 
-                def __setitem__(self, key, value):
+                def __setitem__(self, key, value) -> None:
                     """
                     Intercept method.
 
@@ -220,10 +220,10 @@ def __setitem__(self, key, value):
                         value = StateModuleFuncWrapper(value, wrapper_cls)
                     return super().__setitem__(key, value)
 
-            loader_dict = _modules._dict.copy()
-            _modules._dict = ModulesLoaderDict()
+            loader_dict = _modules._dict.copy()  # noqa: SLF001
+            _modules._dict = ModulesLoaderDict()  # noqa: SLF001
             for key, value in loader_dict.items():
-                _modules._dict[key] = value
+                _modules._dict[key] = value  # noqa: SLF001
 
             self._modules = _modules
         return self._modules
@@ -292,11 +292,11 @@ class StatesLoaderDict(_states.mod_dict_class):
                 Custom class to implement wrappers.
                 """
 
-                def __init__(self, proxy_func, *args, **kwargs):
+                def __init__(self, proxy_func, *args, **kwargs) -> None:
                     super().__init__(*args, **kwargs)
                     self.__proxy_func__ = proxy_func
 
-                def __setitem__(self, name, func):
+                def __setitem__(self, name, func) -> None:
                     """
                     Intercept method.
 
@@ -310,10 +310,10 @@ def __setitem__(self, name, func):
                     func = StateFunction(self.__proxy_func__, name)
                     return super().__setitem__(name, func)
 
-            loader_dict = _states._dict.copy()
-            _states._dict = StatesLoaderDict(self.modules.state.single)
+            loader_dict = _states._dict.copy()  # noqa: SLF001
+            _states._dict = StatesLoaderDict(self.modules.state.single)  # noqa: SLF001
             for key, value in loader_dict.items():
-                _states._dict[key] = value
+                _states._dict[key] = value  # noqa: SLF001
 
             self._states = _states
         return self._states
@@ -380,7 +380,8 @@ def test_user_absent(loaders):
     @state_id.default
     def _state_id(self):
         if not isinstance(self.raw, dict):
-            raise ValueError("The state result errored: {}".format(self.raw))
+            msg = f"The state result errored: {self.raw}"
+            raise TypeError(msg)
         return next(iter(self.raw.keys()))
 
     @full_return.default
@@ -445,7 +446,7 @@ def warnings(self):
         """
         return self.full_return.get("warnings") or []
 
-    def __contains__(self, key):
+    def __contains__(self, key) -> bool:
         """
         Checks for the existence of ``key`` in the full state return dictionary.
         """
@@ -458,23 +459,22 @@ def __getitem__(self, key):
         try:
             return self.full_return[key]
         except KeyError:
-            raise KeyError("The '{}' key was not found in the state return".format(key)) from None
+            msg = f"The '{key}' key was not found in the state return"
+            raise KeyError(msg) from None
 
     def __eq__(self, _):
         """
         Override method.
         """
-        raise TypeError(
-            "Please assert comparisons with {}.filtered instead".format(self.__class__.__name__)
-        )
+        msg = f"Please assert comparisons with {self.__class__.__name__}.filtered instead"
+        raise TypeError(msg)
 
-    def __bool__(self):
+    def __bool__(self) -> bool:  # pylint: disable=invalid-bool-returned
         """
         Override method.
         """
-        raise TypeError(
-            "Please assert comparisons with {}.filtered instead".format(self.__class__.__name__)
-        )
+        msg = f"Please assert comparisons with {self.__class__.__name__}.filtered instead"
+        raise TypeError(msg)
 
 
 @attr.s
@@ -495,7 +495,7 @@ def __call__(self, *args, **kwargs):
         """
         log.info(
             "Calling %s",
-            format_callback_to_string("state.single", (self.state_func,) + args, kwargs),
+            format_callback_to_string("state.single", (self.state_func, *args), kwargs),
         )
         return self.proxy_func(self.state_func, *args, **kwargs)
 
@@ -570,14 +570,14 @@ def __iter__(self):
         """
         return iter(self._structured)
 
-    def __contains__(self, key):
+    def __contains__(self, key) -> bool:
         """
         Check the presence of ``key`` in the state return.
         """
-        for state_result in self:
-            if key in (state_result.id, state_result.state_id, state_result.name):
-                return True
-        return False
+        return any(
+            key in (state_result.id, state_result.state_id, state_result.name)
+            for state_result in self
+        )
 
     def __getitem__(self, state_id_or_index):
         """
@@ -621,7 +621,8 @@ def __getitem__(self, state_id_or_index):
         for state_result in self:
             if state_id_or_index in (state_result.id, state_result.state_id, state_result.name):
                 return state_result
-        raise KeyError("No state by the ID of '{}' was found".format(state_id_or_index))
+        msg = f"No state by the ID of '{state_id_or_index}' was found"
+        raise KeyError(msg)
 
     @property
     def failed(self):
diff --git a/src/saltfactories/utils/loader.py b/src/saltfactories/utils/loader.py
index d9f71875..64ef5a08 100644
--- a/src/saltfactories/utils/loader.py
+++ b/src/saltfactories/utils/loader.py
@@ -89,15 +89,17 @@ def start(self):
                 globals_to_mock,
             )
             if not isinstance(module, types.ModuleType):
-                raise pytest.UsageError(
-                    "The dictionary keys returned by setup_loader_modules() "
-                    "must be an imported module, not {}".format(type(module))
+                msg = (
+                    "The dictionary keys returned by setup_loader_modules() must be an imported module, "
+                    f"not {type(module)}"
                 )
+                raise pytest.UsageError(msg)
             if not isinstance(globals_to_mock, dict):
-                raise pytest.UsageError(
-                    "The dictionary values returned by setup_loader_modules() "
-                    "must be a dictionary, not {}".format(type(globals_to_mock))
+                msg = (
+                    "The dictionary values returned by setup_loader_modules() must be a dictionary, "
+                    f"not {type(globals_to_mock)}"
                 )
+                raise pytest.UsageError(msg)
             for key in self.salt_module_dunders:
                 if not hasattr(module, key):
                     # Set the dunder name as an attribute on the module if not present
@@ -126,13 +128,8 @@ def stop(self):
             try:
                 log.log(LOGGING_TRACE_LEVEL, "Calling finalizer %s", func_repr)
                 func(*args, **kwargs)
-            except Exception as exc:  # pragma: no cover pylint: disable=broad-except
-                log.error(
-                    "Failed to run finalizer %s: %s",
-                    func_repr,
-                    exc,
-                    exc_info=True,
-                )
+            except Exception:  # pragma: no cover pylint: disable=broad-except
+                log.exception("Failed to run finalizer %s", func_repr)
 
     def addfinalizer(self, func, *args, **kwargs):
         """
@@ -145,9 +142,8 @@ def _patch_sys_modules(self, mocks):
             return
         sys_modules = mocks["sys.modules"]
         if not isinstance(sys_modules, dict):
-            raise pytest.UsageError(
-                "'sys.modules' must be a dictionary not: {}".format(type(sys_modules))
-            )
+            msg = f"'sys.modules' must be a dictionary not: {type(sys_modules)}"
+            raise pytest.UsageError(msg)
         patcher = patch.dict(sys.modules, values=sys_modules)
         patcher.start()
         self.addfinalizer(patcher.stop)
@@ -162,20 +158,12 @@ def _patch_module_globals(self, module, mocks, module_globals):
 
             if key.startswith("__"):
                 if key in ("__init__", "__virtual__"):
-                    raise pytest.UsageError(
-                        "No need to patch {!r}. Passed loader module dict: {}".format(
-                            key,
-                            self.setup_loader_modules,
-                        )
-                    )
-                elif key not in allowed_salt_dunders:
-                    raise pytest.UsageError(
-                        "Don't know how to handle {!r}. Passed loader module dict: {}".format(
-                            key,
-                            self.setup_loader_modules,
-                        )
-                    )
-                elif key in salt_dunder_dicts and not hasattr(module, key):
+                    msg = f"No need to patch {key!r}. Passed loader module dict: {self.setup_loader_modules}"
+                    raise pytest.UsageError(msg)
+                if key not in allowed_salt_dunders:
+                    msg = f"Don't know how to handle {key!r}. Passed loader module dict: {self.setup_loader_modules}"
+                    raise pytest.UsageError(msg)
+                if key in salt_dunder_dicts and not hasattr(module, key):
                     # Add the key as a dictionary attribute to the module so it can be patched by `patch.dict`'
                     setattr(module, key, {})
                     # Remove the added attribute after the test finishes
diff --git a/src/saltfactories/utils/markers.py b/src/saltfactories/utils/markers.py
index 97a4bf14..668eddb6 100644
--- a/src/saltfactories/utils/markers.py
+++ b/src/saltfactories/utils/markers.py
@@ -4,11 +4,8 @@
 import fnmatch
 import logging
 
-import _pytest._version
 import pytest
 
-PYTEST_GE_7 = getattr(_pytest._version, "version_tuple", (-1, -1)) >= (7, 0)
-
 log = logging.getLogger(__name__)
 
 
@@ -31,7 +28,7 @@ def check_required_loader_attributes(loader_instance, loader_attr, required_item
     available_items = list(getattr(loader_instance, loader_attr))
     not_available_items = set()
 
-    name = "__not_available_{items}s__".format(items=loader_attr)
+    name = f"__not_available_{loader_attr}s__"
     if not hasattr(loader_instance, name):
         cached_not_available_items = set()
         setattr(loader_instance, name, cached_not_available_items)
@@ -55,32 +52,26 @@ def check_required_loader_attributes(loader_instance, loader_attr, required_item
     return not_available_items
 
 
-def evaluate_markers(item):
+def evaluate_markers(item):  # noqa: PLR0915
     """
     Fixtures injection based on markers or test skips based on CLI arguments.
     """
     # Two special markers, requires_salt_modules and requires_salt_states. These need access to a
     # saltfactories.utils.functional.Loader instance
     # They will use a session_markers_loader fixture to gain access to that
-    exc_kwargs = {}
-    if PYTEST_GE_7:
-        exc_kwargs["_use_item_location"] = True
     requires_salt_modules_marker = item.get_closest_marker("requires_salt_modules")
     if requires_salt_modules_marker is not None:
         if requires_salt_modules_marker.kwargs:
-            raise pytest.UsageError(
-                "The 'required_salt_modules' marker does not accept keyword arguments"
-            )
+            msg = "The 'required_salt_modules' marker does not accept keyword arguments"
+            raise pytest.UsageError(msg)
         required_salt_modules = requires_salt_modules_marker.args
         if not required_salt_modules:
-            raise pytest.UsageError(
-                "The 'required_salt_modules' marker needs at least one module name to be passed"
-            )
+            msg = "The 'required_salt_modules' marker needs at least one module name to be passed"
+            raise pytest.UsageError(msg)
         for arg in required_salt_modules:
             if not isinstance(arg, str):
-                raise pytest.UsageError(
-                    "The 'required_salt_modules' marker only accepts strings as arguments"
-                )
+                msg = "The 'required_salt_modules' marker only accepts strings as arguments"
+                raise pytest.UsageError(msg)
         session_markers_loader = item._request.getfixturevalue("session_markers_loader")
         required_salt_modules = set(required_salt_modules)
         not_available_modules = check_required_loader_attributes(
@@ -90,30 +81,24 @@ def evaluate_markers(item):
         if not_available_modules:
             item._skipped_by_mark = True
             if len(not_available_modules) == 1:
-                raise pytest.skip.Exception(
-                    "Salt module '{}' is not available".format(*not_available_modules), **exc_kwargs
-                )
-            raise pytest.skip.Exception(
-                "Salt modules not available: {}".format(", ".join(not_available_modules)),
-                **exc_kwargs
-            )
+                msg = "Salt module '{}' is not available".format(*not_available_modules)
+                raise pytest.skip.Exception(msg, _use_item_location=True)
+            msg = "Salt modules not available: {}".format(", ".join(not_available_modules))
+            raise pytest.skip.Exception(msg, _use_item_location=True)
 
     requires_salt_states_marker = item.get_closest_marker("requires_salt_states")
     if requires_salt_states_marker is not None:
         if requires_salt_states_marker.kwargs:
-            raise pytest.UsageError(
-                "The 'required_salt_states' marker does not accept keyword arguments"
-            )
+            msg = "The 'required_salt_states' marker does not accept keyword arguments"
+            raise pytest.UsageError(msg)
         required_salt_states = requires_salt_states_marker.args
         if not required_salt_states:
-            raise pytest.UsageError(
-                "The 'required_salt_states' marker needs at least one state module name to be passed"
-            )
+            msg = "The 'required_salt_states' marker needs at least one state module name to be passed"
+            raise pytest.UsageError(msg)
         for arg in required_salt_states:
             if not isinstance(arg, str):
-                raise pytest.UsageError(
-                    "The 'required_salt_states' marker only accepts strings as arguments"
-                )
+                msg = "The 'required_salt_states' marker only accepts strings as arguments"
+                raise pytest.UsageError(msg)
         session_markers_loader = item._request.getfixturevalue("session_markers_loader")
         required_salt_states = set(required_salt_states)
         not_available_states = check_required_loader_attributes(
@@ -123,29 +108,24 @@ def evaluate_markers(item):
         if not_available_states:
             item._skipped_by_mark = True
             if len(not_available_states) == 1:
-                raise pytest.skip.Exception(
-                    "Salt state module '{}' is not available".format(*not_available_states),
-                    **exc_kwargs
-                )
-            raise pytest.skip.Exception(
-                "Salt state modules not available: {}".format(
-                    ", ".join(not_available_states), **exc_kwargs
-                )
+                msg = "Salt state module '{}' is not available".format(*not_available_states)
+                raise pytest.skip.Exception(msg, _use_item_location=True)
+            msg = "Salt state modules not available: {}".format(
+                ", ".join(not_available_states),
             )
+            raise pytest.skip.Exception(msg, _use_item_location=True)
 
     skip_on_salt_system_service_marker = item.get_closest_marker("skip_on_salt_system_service")
     if skip_on_salt_system_service_marker is not None:
         if skip_on_salt_system_service_marker.args:
-            raise pytest.UsageError(
-                "The 'skip_on_salt_system_service' marker does not accept any arguments"
-            )
+            msg = "The 'skip_on_salt_system_service' marker does not accept any arguments"
+            raise pytest.UsageError(msg)
         reason = skip_on_salt_system_service_marker.kwargs.pop("reason", None)
         if reason is None:
             reason = "Test should not run against system install of Salt"
         if skip_on_salt_system_service_marker.kwargs:
-            raise pytest.UsageError(
-                "The 'skip_on_salt_system_service' marker only accepts 'reason' as a keyword argument"
-            )
+            msg = "The 'skip_on_salt_system_service' marker only accepts 'reason' as a keyword argument"
+            raise pytest.UsageError(msg)
         salt_factories = item._request.getfixturevalue("salt_factories")
         if salt_factories.system_service is True:
-            raise pytest.skip.Exception(reason, **exc_kwargs)
+            raise pytest.skip.Exception(reason, _use_item_location=True)
diff --git a/src/saltfactories/utils/tempfiles.py b/src/saltfactories/utils/tempfiles.py
index f643939b..88f73c68 100644
--- a/src/saltfactories/utils/tempfiles.py
+++ b/src/saltfactories/utils/tempfiles.py
@@ -36,7 +36,6 @@ def temp_directory(name=None, basepath=None):
 
 
         def test_func():
-
             with temp_directory() as temp_path:
                 assert temp_path.is_dir()
 
@@ -108,7 +107,6 @@ def temp_file(name=None, contents=None, directory=None, strip_first_newline=True
 
 
         def test_func():
-
             with temp_file(name="blah.txt") as temp_path:
                 assert temp_path.is_file()
 
@@ -192,7 +190,7 @@ def test_absolute_subdirectory_2():
     create_directories = file_path.parent.relative_to(directory)
 
     if create_directories:
-        with temp_directory(create_directories, basepath=directory):
+        with temp_directory(create_directories, basepath=directory):  # noqa: SIM117
             with _write_or_touch(file_path, contents, strip_first_newline=strip_first_newline):
                 yield file_path
     else:
@@ -255,7 +253,7 @@ def __attrs_post_init__(self):
         for idx, path in enumerate(self.paths[:]):
             if not isinstance(path, pathlib.Path):
                 # We have to cast path to a string because on Py3.5, path might be an instance of pathlib2.Path
-                path = pathlib.Path(str(path))
+                path = pathlib.Path(str(path))  # noqa: PLW2901
                 self.paths[idx] = path
             path.mkdir(parents=True, exist_ok=True)
 
@@ -329,7 +327,7 @@ def __attrs_post_init__(self):
         for envname, envtree in self.envs.items():
             if not isinstance(envtree, SaltEnv):
                 if isinstance(envtree, str):
-                    envtree = [envtree]
+                    envtree = [envtree]  # noqa: PLW2901
                 self.envs[envname] = SaltEnv(name=envname, paths=envtree)
             setattr(self, envname, self.envs[envname])
 
diff --git a/src/saltfactories/utils/virtualenv.py b/src/saltfactories/utils/virtualenv.py
index f896c402..4504569f 100644
--- a/src/saltfactories/utils/virtualenv.py
+++ b/src/saltfactories/utils/virtualenv.py
@@ -82,7 +82,8 @@ def __enter__(self):
         try:
             self._create_virtualenv()
         except subprocess.CalledProcessError as exc:
-            raise AssertionError("Failed to create virtualenv") from exc
+            msg = "Failed to create virtualenv"
+            raise AssertionError(msg) from exc
         return self
 
     def __exit__(self, *_):
@@ -109,7 +110,7 @@ def run(self, *args, **kwargs):
         kwargs.setdefault("stderr", subprocess.PIPE)
         kwargs.setdefault("universal_newlines", True)
         kwargs.setdefault("env", self.environ)
-        proc = subprocess.run(args, check=False, **kwargs)
+        proc = subprocess.run(args, check=False, **kwargs)  # noqa: S603
         ret = ProcessResult(
             returncode=proc.returncode,
             stdout=proc.stdout,
@@ -121,7 +122,8 @@ def run(self, *args, **kwargs):
             try:
                 proc.check_returncode()
             except subprocess.CalledProcessError as exc:  # pragma: no cover
-                raise ProcessFailed("Command failed return code check", process_result=ret) from exc
+                msg = "Command failed return code check"
+                raise ProcessFailed(msg, process_result=ret) from exc
         return ret
 
     @staticmethod
@@ -140,23 +142,21 @@ def get_real_python():
         try:
             if platform.is_windows():
                 return os.path.join(sys.real_prefix, os.path.basename(sys.executable))
+            python_binary_names = [
+                "python{}.{}".format(*sys.version_info),
+                "python{}".format(*sys.version_info),
+                "python",
+            ]
+            for binary_name in python_binary_names:
+                python = os.path.join(sys.real_prefix, "bin", binary_name)
+                if os.path.exists(python):
+                    break
             else:
-                python_binary_names = [
-                    "python{}.{}".format(*sys.version_info),
-                    "python{}".format(*sys.version_info),
-                    "python",
-                ]
-                for binary_name in python_binary_names:
-                    python = os.path.join(sys.real_prefix, "bin", binary_name)
-                    if os.path.exists(python):
-                        break
-                else:
-                    raise AssertionError(
-                        "Couldn't find a python binary name under '{}' matching: {}".format(
-                            os.path.join(sys.real_prefix, "bin"), python_binary_names
-                        )
-                    )
-                return python
+                msg = "Couldn't find a python binary name under '{}' matching: {}".format(
+                    os.path.join(sys.real_prefix, "bin"), python_binary_names
+                )
+                raise AssertionError(msg)
+            return python  # noqa: TRY300
         except AttributeError:
             return sys.executable
 
@@ -199,7 +199,7 @@ def _create_virtualenv(self):
                 passed_python = True
             args.append(arg)
         if passed_python is False:
-            args.append("--python={}".format(self.get_real_python()))
+            args.append(f"--python={self.get_real_python()}")
         args.append(str(self.venv_dir))
         # We pass CWD because run defaults to the venv_dir, which, at this stage
         # is not yet created


Test patch:
diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml
index b2fd9fa3..d57760ce 100644
--- a/.github/workflows/testing.yml
+++ b/.github/workflows/testing.yml
@@ -1,6 +1,20 @@
 name: CI
+run-name: "CI (${{ github.event_name == 'pull_request' && format('pr: #{0}', github.event.number) || format('{0}: {1}', startsWith(github.event.ref, 'refs/tags') && 'tag' || 'branch', github.ref_name) }})"
 
-on: [push, pull_request]
+on:
+  - push
+  - pull_request
+
+env:
+  COLUMNS: 190
+
+concurrency:
+  # Concurrency is defined in a way that concurrent builds against branches do
+  # not cancel previous builds.
+  # However, for every new build against the same pull request source branch,
+  # all older builds against that same branch get canceled.
+  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.repository }}-${{ github.head_ref || github.run_id }}
+  cancel-in-progress: true
 
 jobs:
   Pre-Commit:
@@ -36,15 +50,15 @@ jobs:
       with:
         fetch-depth: 0
 
-    - name: Set up Python 3.7 For Nox
+    - name: Set up Python 3.9 For Nox
       uses: actions/setup-python@v4
       with:
-        python-version: 3.7
+        python-version: 3.9
 
     - name: Install Nox
       run: |
         python -m pip install --upgrade pip
-        pip install nox
+        python -m pip install nox
 
     - name: Set up Python ${{ matrix.python-version }}
       uses: actions/setup-python@v4
@@ -79,7 +93,7 @@ jobs:
     - name: Install Nox
       run: |
         python -m pip install --upgrade pip
-        pip install nox
+        python -m pip install nox
 
     - name: Install Lint Requirements
       run: |
@@ -102,7 +116,7 @@ jobs:
       fail-fast: false
       matrix:
         pytest-version:
-          - "~=6.2.0"
+          - "7.3.0"
 
     steps:
     - uses: actions/checkout@v3
@@ -114,35 +128,16 @@ jobs:
         sudo -E apt-get update
         sudo -E apt-get install -y python3-setuptools python-is-python3
         sudo -E python3 -m pip install --upgrade pip
-        sudo -E python3 -m pip install 'nox<2022.8.7' 'pytest${{ matrix.pytest-version }}'
+        sudo -E python3 -m pip install 'nox<2022.8.7'
         sudo mv /usr/bin/pip /usr/bin/pip2
         sudo ln -sf /usr/bin/pip3 /usr/bin/pip
 
     - name: Install Salt
       run: |
-        curl -L https://bootstrap.saltstack.com | sudo sh -s -- -M -X -x python3 stable
+        curl -L https://bootstrap.saltstack.com | sudo sh -s -- -M -X -x python3 old-stable 3005
         sudo apt-get install -y salt-api salt-ssh salt-syndic salt-cloud python3-pip
-        # We need to upgrade pyzmq or we'll get coredumps
-        sudo python3 -m pip install --ignore-installed -U pyzmq==19.0.0
         for service in $(sudo systemctl list-unit-files | grep salt | grep -v @ | awk '{ print $1 }'); do sudo systemctl stop $service; done
 
-    - name: Gather CodeCov Info
-      if: always()
-      id: codecov-info
-      run: |
-        echo ::set-output name=flag-python-version::$(python3 -c "import sys; print('Py{}{}'.format(*sys.version_info))")
-        echo ::set-output name=flag-pytest-version::$(python3 -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))")
-        echo ::set-output name=flag-salt-version::Salt$(salt --version | awk '{ print $2 }')
-        echo ::set-output name=flag-runner-os::$(python3 -c "print('${{ runner.os }}'.replace('-latest', ''))")
-        echo ::set-output name=uploader-url::$(python3 -c "print('https://uploader.codecov.io/latest/codecov-linux')")
-
-    - name: Create CodeCov Flags
-      if: always()
-      id: codecov
-      run: |
-        echo ::set-output name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))")
-        echo ::set-output name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))")
-
     - name: Install Test Requirements
       run: |
         sudo -E nox --force-color -e tests --no-venv --install-only
@@ -154,95 +149,28 @@ jobs:
       run: |
         sudo -E nox --force-color -e tests --no-venv -- -vv tests/
 
-    - name: Upload Salt Factories Code Coverage
-      if: always()
-      continue-on-error: true
-      shell: bash
-      env:
-        REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},system,src
-        REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-system-src
-        REPORT_PATH: artifacts/coverage-saltfactories.xml
-      run: |
-        if [ ! -f codecov-uploader ]; then
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to download uploader"
-            exit 1
-        fi
-        if [ -f codecov-uploader ]; then
-            chmod +x codecov-uploader
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if ./codecov-uploader -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to upload codecov stats"
-            exit 1
-        fi
-
-    - name: Upload Salt Factories Tests Code Coverage
-      if: always()
-      continue-on-error: true
-      shell: bash
-      env:
-        REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},system,tests
-        REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-system-tests
-        REPORT_PATH: artifacts/coverage-tests.xml
-      run: |
-        if [ ! -f codecov-uploader ]; then
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to download uploader"
-            exit 1
-        fi
-        if [ -f codecov-uploader ]; then
-            chmod +x codecov-uploader
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if ./codecov-uploader -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to upload codecov stats"
-            exit 1
-        fi
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action@v3
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}
+        directory: artifacts/
+        fail_ci_if_error: false
+        files: coverage-project.xml
+        flags: src,${{ runner.os }},salt-${{ matrix.salt-version }},py${{ matrix.python-version }},pytest-${{ matrix.pytest-version }}
+        name: project-${{ runner.os }}-Salt-${{ matrix.salt-version }}-Py${{ matrix.python-version}}-Pytest${{ matrix.pytest-version }}
+        verbose: true
+
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action@v3
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}
+        directory: artifacts/
+        env_vars: PYTHON,SALT,TESTSUITE,SOURCE
+        fail_ci_if_error: false
+        files: coverage-tests.xml
+        flags: tests,${{ runner.os }},salt-${{ matrix.salt-version }},py${{ matrix.python-version }},pytest-${{ matrix.pytest-version }}
+        name: tests-${{ runner.os }}-Salt-${{ matrix.salt-version }}-Py${{ matrix.python-version}}-Pytest${{ matrix.pytest-version }}
+        verbose: true
 
     - name: Upload Logs
       if: always()
@@ -260,28 +188,17 @@ jobs:
 
     strategy:
       fail-fast: false
-      max-parallel: 9
+      max-parallel: 16
       matrix:
         python-version:
-          - "3.7"
           - "3.8"
+          - "3.9"
+          - "3.10"
         salt-version:
-          - salt~=3004.0,!=3004.1
-          - salt~=3005.0
+          - "3006.0"
         pytest-version:
-          - "~=6.2.0"
-          - "~=7.0.0"
-          - "~=7.1.0"
-        exclude:
-          - {"python-version": "3.8", "pytest-version": "~=6.2.0", "salt-version": "salt~=3004.0,!=3004.1"}
-          - {"python-version": "3.8", "pytest-version": "~=7.0.0", "salt-version": "salt~=3004.0,!=3004.1"}
-          - {"python-version": "3.8", "pytest-version": "~=7.1.0", "salt-version": "salt~=3004.0,!=3004.1"}
-          - {"python-version": "3.7", "pytest-version": "~=6.2.0", "salt-version": "salt~=3005.0"}
-          - {"python-version": "3.7", "pytest-version": "~=7.0.0", "salt-version": "salt~=3005.0"}
-          - {"python-version": "3.7", "pytest-version": "~=7.1.0", "salt-version": "salt~=3005.0"}
-          - {"python-version": "3.8", "pytest-version": "~=6.2.0", "salt-version": "salt~=3005.0"}
-          - {"python-version": "3.8", "pytest-version": "~=7.0.0", "salt-version": "salt~=3005.0"}
-          - {"python-version": "3.8", "pytest-version": "~=7.1.0", "salt-version": "salt~=3005.0"}
+          - "7.3.0"
+          - "7.4.0"
 
     steps:
     - uses: actions/checkout@v3
@@ -296,32 +213,13 @@ jobs:
     - name: Install Nox
       run: |
         python -m pip install --upgrade pip
-        pip install nox 'pytest${{ matrix.pytest-version }}'
-
-    - name: Gather CodeCov Info
-      if: always()
-      id: codecov-info
-      shell: bash
-      run: |
-        echo ::set-output name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))")
-        echo ::set-output name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))")
-        echo ::set-output name=flag-salt-version::$(python -c "print('Salt{}'.format('_'.join(str(v) for v in '${{ matrix.salt-version }}'.split('==')[-1].split('.'))))")
-        echo ::set-output name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))")
-        echo ::set-output name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/codecov.exe')")
-
-    - name: Create CodeCov Flags
-      if: always()
-      id: codecov
-      shell: bash
-      run: |
-        echo ::set-output name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))")
-        echo ::set-output name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))")
+        python -m pip install nox
 
     - name: Install Test Requirements
       shell: bash
       env:
-        SALT_REQUIREMENT: ${{ matrix.salt-version }}
-        PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }}
+        SALT_REQUIREMENT: salt~=${{ matrix.salt-version }}
+        PYTEST_VERSION_REQUIREMENT: pytest~=${{ matrix.pytest-version }}
       run: |
         export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH"
         nox --force-color -e tests-${{ matrix.python-version }} --install-only
@@ -330,100 +228,35 @@ jobs:
       id: run-tests
       shell: bash
       env:
-        SALT_REQUIREMENT: ${{ matrix.salt-version }}
-        PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }}
+        SALT_REQUIREMENT: salt~=${{ matrix.salt-version }}
+        PYTEST_VERSION_REQUIREMENT: pytest~=${{ matrix.pytest-version }}
         SKIP_REQUIREMENTS_INSTALL: YES
       run: |
         export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH"
         nox --force-color -e tests-${{ matrix.python-version }} -- -vv tests/
 
-    - name: Upload Salt Factories Code Coverage
-      if: always()
-      shell: bash
-      env:
-        REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},src
-        REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-src
-        REPORT_PATH: artifacts/coverage-saltfactories.xml
-      run: |
-        if [ ! -f codecov-uploader ]; then
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to download uploader"
-            exit 1
-        fi
-        if [ -f codecov-uploader ]; then
-            chmod +x codecov-uploader
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if ./codecov-uploader -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to upload codecov stats"
-            exit 1
-        fi
-
-    - name: Upload Salt Factories Tests Code Coverage
-      if: always()
-      shell: bash
-      env:
-        REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},tests
-        REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-tests
-        REPORT_PATH: artifacts/coverage-tests.xml
-      run: |
-        if [ ! -f codecov-uploader ]; then
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to download uploader"
-            exit 1
-        fi
-        if [ -f codecov-uploader ]; then
-            chmod +x codecov-uploader
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if ./codecov-uploader -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to upload codecov stats"
-            exit 1
-        fi
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action@v3
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}
+        directory: artifacts/
+        fail_ci_if_error: false
+        files: coverage-project.xml
+        flags: src,${{ runner.os }},salt-${{ matrix.salt-version }},py${{ matrix.python-version }},pytest-${{ matrix.pytest-version }}
+        name: project-${{ runner.os }}-Salt-${{ matrix.salt-version }}-Py${{ matrix.python-version}}-Pytest${{ matrix.pytest-version }}
+        verbose: true
+
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action@v3
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}
+        directory: artifacts/
+        env_vars: PYTHON,SALT,TESTSUITE,SOURCE
+        fail_ci_if_error: false
+        files: coverage-tests.xml
+        flags: tests,${{ runner.os }},salt-${{ matrix.salt-version }},py${{ matrix.python-version }},pytest-${{ matrix.pytest-version }}
+        name: tests-${{ runner.os }}-Salt-${{ matrix.salt-version }}-Py${{ matrix.python-version}}-Pytest${{ matrix.pytest-version }}
+        verbose: true
 
     - name: Upload Logs
       if: always()
@@ -433,7 +266,7 @@ jobs:
         path: artifacts/runtests-*.log
 
 
-  macOS:
+  MacOS:
     runs-on: macOS-latest
     needs: Pre-Commit
 
@@ -441,28 +274,16 @@ jobs:
 
     strategy:
       fail-fast: false
-      max-parallel: 9
+      max-parallel: 16
       matrix:
         python-version:
-          - "3.7"
           - "3.9"
+          - "3.10"
         salt-version:
-          - salt~=3004.0
-          - salt~=3005.0
+          - "3006.0"
         pytest-version:
-          - "~=6.2.0"
-          - "~=7.0.0"
-          - "~=7.1.0"
-        exclude:
-          - {"python-version": "3.9", "pytest-version": "~=6.2.0", "salt-version": "salt~=3004.0"}
-          - {"python-version": "3.9", "pytest-version": "~=7.0.0", "salt-version": "salt~=3004.0"}
-          - {"python-version": "3.9", "pytest-version": "~=7.1.0", "salt-version": "salt~=3004.0"}
-          - {"python-version": "3.7", "pytest-version": "~=6.2.0", "salt-version": "salt~=3005.0"}
-          - {"python-version": "3.7", "pytest-version": "~=7.0.0", "salt-version": "salt~=3005.0"}
-          - {"python-version": "3.7", "pytest-version": "~=7.1.0", "salt-version": "salt~=3005.0"}
-          - {"python-version": "3.9", "pytest-version": "~=6.2.0", "salt-version": "salt~=3005.0"}
-          - {"python-version": "3.9", "pytest-version": "~=7.0.0", "salt-version": "salt~=3005.0"}
-          - {"python-version": "3.9", "pytest-version": "~=7.1.0", "salt-version": "salt~=3005.0"}
+          - "7.3.0"
+          - "7.4.0"
 
     steps:
     - uses: actions/checkout@v3
@@ -477,126 +298,46 @@ jobs:
     - name: Install Nox
       run: |
         python -m pip install --upgrade pip
-        pip install nox 'pytest${{ matrix.pytest-version }}'
-
-    - name: Gather CodeCov Info
-      if: always()
-      id: codecov-info
-      run: |
-        echo ::set-output name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))")
-        echo ::set-output name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))")
-        echo ::set-output name=flag-salt-version::$(python -c "print('Salt{}'.format('_'.join(str(v) for v in '${{ matrix.salt-version }}'.split('==')[-1].split('.'))))")
-        echo ::set-output name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))")
-        echo ::set-output name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/codecov-macos')")
-
-    - name: Create CodeCov Flags
-      if: always()
-      id: codecov
-      run: |
-        echo ::set-output name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))")
-        echo ::set-output name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))")
+        python -m pip install nox
 
     - name: Install Test Requirements
       env:
-        SALT_REQUIREMENT: ${{ matrix.salt-version }}
+        SALT_REQUIREMENT: salt~=${{ matrix.salt-version }}
+        PYTEST_VERSION_REQUIREMENT: pytest~=${{ matrix.pytest-version }}
       run: |
         nox --force-color -e tests-${{ matrix.python-version }} --install-only
 
     - name: Test
       id: run-tests
       env:
-        SALT_REQUIREMENT: ${{ matrix.salt-version }}
+        SALT_REQUIREMENT: salt~=${{ matrix.salt-version }}
+        PYTEST_VERSION_REQUIREMENT: pytest~=${{ matrix.pytest-version }}
         SKIP_REQUIREMENTS_INSTALL: YES
       run: |
         nox --force-color -e tests-${{ matrix.python-version }} -- -vv tests/
 
-    - name: Upload Salt Factories Code Coverage
-      if: always()
-      shell: bash
-      env:
-        REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},src
-        REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-src
-        REPORT_PATH: artifacts/coverage-saltfactories.xml
-      run: |
-        if [ ! -f codecov-uploader ]; then
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to download uploader"
-            exit 1
-        fi
-        if [ -f codecov-uploader ]; then
-            chmod +x codecov-uploader
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if ./codecov-uploader -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to upload codecov stats"
-            exit 1
-        fi
-
-    - name: Upload Salt Factories Tests Code Coverage
-      if: always()
-      shell: bash
-      env:
-        REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},tests
-        REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-tests
-        REPORT_PATH: artifacts/coverage-tests.xml
-      run: |
-        if [ ! -f codecov-uploader ]; then
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to download uploader"
-            exit 1
-        fi
-        if [ -f codecov-uploader ]; then
-            chmod +x codecov-uploader
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if ./codecov-uploader -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to upload codecov stats"
-            exit 1
-        fi
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action@v3
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}
+        directory: artifacts/
+        fail_ci_if_error: false
+        files: coverage-project.xml
+        flags: src,${{ runner.os }},salt-${{ matrix.salt-version }},py${{ matrix.python-version }},pytest-${{ matrix.pytest-version }}
+        name: project-${{ runner.os }}-Salt-${{ matrix.salt-version }}-Py${{ matrix.python-version}}-Pytest${{ matrix.pytest-version }}
+        verbose: true
+
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action@v3
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}
+        directory: artifacts/
+        env_vars: PYTHON,SALT,TESTSUITE,SOURCE
+        fail_ci_if_error: false
+        files: coverage-tests.xml
+        flags: tests,${{ runner.os }},salt-${{ matrix.salt-version }},py${{ matrix.python-version }},pytest-${{ matrix.pytest-version }}
+        name: tests-${{ runner.os }}-Salt-${{ matrix.salt-version }}-Py${{ matrix.python-version}}-Pytest${{ matrix.pytest-version }}
+        verbose: true
 
     - name: Upload Logs
       if: always()
@@ -620,17 +361,15 @@ jobs:
           - "3.7"
           - "3.8"
           - "3.9"
+          - "3.10"
         salt-version:
-          - salt~=3004.0
-          - salt~=3005.0
+          - "3005.0"
+          - "3006.0"
         pytest-version:
-          - "~=6.1.0"
-          - "~=6.2.0"
-          - "~=7.0.0"
-          - "~=7.1.0"
+          - "7.3.0"
+          - "7.4.0"
         exclude:
-          - {"python-version": "3.10", "pytest-version": "~=6.1.0", "salt-version": "salt~=3004.0"}
-          - {"python-version": "3.10", "pytest-version": "~=6.1.0", "salt-version": "salt~=3005.0"}
+          - {"python-version": "3.10", "salt-version": "3005.0"}
 
     steps:
     - uses: actions/checkout@v3
@@ -645,127 +384,46 @@ jobs:
     - name: Install Nox
       run: |
         python -m pip install --upgrade pip
-        pip install nox 'pytest${{ matrix.pytest-version }}'
-
-    - name: Gather CodeCov Info
-      if: always()
-      id: codecov-info
-      run: |
-        echo ::set-output name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))")
-        echo ::set-output name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))")
-        echo ::set-output name=flag-salt-version::$(python -c "print('Salt{}'.format('_'.join(str(v) for v in '${{ matrix.salt-version }}'.split('==')[-1].split('.'))))")
-        echo ::set-output name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))")
-        echo ::set-output name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/codecov-linux')")
-
-    - name: Create CodeCov Flags
-      if: always()
-      id: codecov
-      run: |
-        echo ::set-output name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))")
-        echo ::set-output name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))")
+        python -m pip install nox
 
     - name: Install Test Requirements
       env:
-        SALT_REQUIREMENT: ${{ matrix.salt-version }}
-        PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }}
+        SALT_REQUIREMENT: salt~=${{ matrix.salt-version }}
+        PYTEST_VERSION_REQUIREMENT: pytest~=${{ matrix.pytest-version }}
       run: |
         nox --force-color -e tests-${{ matrix.python-version }} --install-only
 
     - name: Test
       id: run-tests
       env:
-        SALT_REQUIREMENT: ${{ matrix.salt-version }}
+        SALT_REQUIREMENT: salt~=${{ matrix.salt-version }}
+        PYTEST_VERSION_REQUIREMENT: pytest~=${{ matrix.pytest-version }}
         SKIP_REQUIREMENTS_INSTALL: YES
       run: |
         nox --force-color -e tests-${{ matrix.python-version }} -- -vv --sys-stats tests/
 
-    - name: Upload Salt Factories Code Coverage
-      if: always()
-      shell: bash
-      env:
-        REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},src
-        REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-src
-        REPORT_PATH: artifacts/coverage-saltfactories.xml
-      run: |
-        if [ ! -f codecov-uploader ]; then
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to download uploader"
-            exit 1
-        fi
-        if [ -f codecov-uploader ]; then
-            chmod +x codecov-uploader
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if ./codecov-uploader -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to upload codecov stats"
-            exit 1
-        fi
-
-    - name: Upload Salt Factories Tests Code Coverage
-      if: always()
-      shell: bash
-      env:
-        REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},tests
-        REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-tests
-        REPORT_PATH: artifacts/coverage-tests.xml
-      run: |
-        if [ ! -f codecov-uploader ]; then
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to download uploader"
-            exit 1
-        fi
-        if [ -f codecov-uploader ]; then
-            chmod +x codecov-uploader
-            n=0
-            until [ "$n" -ge 5 ]
-            do
-            if ./codecov-uploader -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
-                rc=$?
-                break
-            fi
-            rc=$?
-            n=$((n+1))
-            sleep 15
-            done
-        fi
-        if [ $rc -ne 0 ]; then
-            echo "Failed to upload codecov stats"
-            exit 1
-        fi
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action@v3
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}
+        directory: artifacts/
+        fail_ci_if_error: false
+        files: coverage-project.xml
+        flags: src,${{ runner.os }},salt-${{ matrix.salt-version }},py${{ matrix.python-version }},pytest-${{ matrix.pytest-version }}
+        name: project-${{ runner.os }}-Salt-${{ matrix.salt-version }}-Py${{ matrix.python-version}}-Pytest${{ matrix.pytest-version }}
+        verbose: true
+
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action@v3
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}
+        directory: artifacts/
+        env_vars: PYTHON,SALT,TESTSUITE,SOURCE
+        fail_ci_if_error: false
+        files: coverage-tests.xml
+        flags: tests,${{ runner.os }},salt-${{ matrix.salt-version }},py${{ matrix.python-version }},pytest-${{ matrix.pytest-version }}
+        name: tests-${{ runner.os }}-Salt-${{ matrix.salt-version }}-Py${{ matrix.python-version}}-Pytest${{ matrix.pytest-version }}
+        verbose: true
 
     - name: Upload Logs
       if: always()
@@ -792,9 +450,11 @@ jobs:
       uses: actions/setup-python@v4
       with:
         python-version: 3.9
+
     - name: Install Nox
       run: |
         python -m pip install nox
+
     - name: Build a binary wheel and a source tarball
       run: |
         nox -e build
diff --git a/examples/echo-extension/tests/unit/states/test_echo.py b/examples/echo-extension/tests/unit/states/test_echo.py
index 2086aa2b..3e879e13 100644
--- a/examples/echo-extension/tests/unit/states/test_echo.py
+++ b/examples/echo-extension/tests/unit/states/test_echo.py
@@ -28,7 +28,7 @@ def test_echoed():
         "name": echo_str,
         "changes": {},
         "result": True,
-        "comment": "The 'echo.echoed' returned: '{}'".format(echo_str),
+        "comment": f"The 'echo.echoed' returned: '{echo_str}'",
     }
     assert echo_state.echoed(echo_str) == expected
 
@@ -40,6 +40,6 @@ def test_reversed():
         "name": echo_str,
         "changes": {},
         "result": True,
-        "comment": "The 'echo.reversed' returned: '{}'".format(expected_str),
+        "comment": f"The 'echo.reversed' returned: '{expected_str}'",
     }
     assert echo_state.reversed(echo_str) == expected
diff --git a/requirements/tests.txt b/requirements/tests.txt
index cf2266f5..281bb9d7 100644
--- a/requirements/tests.txt
+++ b/requirements/tests.txt
@@ -1,5 +1,5 @@
 -r base.txt
 docker>=4.0.0
 pytest-subtests
-pyfakefs==4.4.0; python_version == '3.5'
-pyfakefs; python_version > '3.5'
+pyfakefs
+importlib-metadata
diff --git a/src/saltfactories/utils/saltext/engines/pytest_engine.py b/src/saltfactories/utils/saltext/engines/pytest_engine.py
index 1cf4b57e..420522ab 100644
--- a/src/saltfactories/utils/saltext/engines/pytest_engine.py
+++ b/src/saltfactories/utils/saltext/engines/pytest_engine.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 """
 Salt Factories Engine For Salt.
 
@@ -15,7 +14,7 @@
 from collections.abc import MutableMapping
 
 import salt.utils.event
-import salt.utils.immutabletypes as immutabletypes
+from salt.utils import immutabletypes
 
 try:
     from salt.utils.data import CaseInsensitiveDict
@@ -59,7 +58,7 @@ def start():
         pytest_engine = PyTestEventForwardEngine(opts=opts)
         pytest_engine.start()
     except Exception:  # pragma: no cover pylint: disable=broad-except
-        log.error("Failed to start PyTestEventForwardEngine", exc_info=True)
+        log.exception("Failed to start PyTestEventForwardEngine")
         raise
 
 
@@ -71,19 +70,20 @@ def ext_type_encoder(obj):
         # msgpack doesn't support datetime.datetime and datetime.date datatypes.
         return obj.strftime("%Y%m%dT%H:%M:%S.%f")
     # The same for immutable types
-    elif immutabletypes is not None and isinstance(obj, immutabletypes.ImmutableDict):
-        return dict(obj)
-    elif immutabletypes is not None and isinstance(obj, immutabletypes.ImmutableList):
-        return list(obj)
-    elif immutabletypes is not None and isinstance(obj, immutabletypes.ImmutableSet):
-        # msgpack can't handle set so translate it to tuple
-        return tuple(obj)
-    elif isinstance(obj, set):
+    if immutabletypes is not None:
+        if isinstance(obj, immutabletypes.ImmutableDict):
+            return dict(obj)
+        if isinstance(obj, immutabletypes.ImmutableList):
+            return list(obj)
+        if isinstance(obj, immutabletypes.ImmutableSet):
+            # msgpack can't handle set so translate it to tuple
+            return tuple(obj)
+    if isinstance(obj, set):
         # msgpack can't handle set so translate it to tuple
         return tuple(obj)
-    elif CaseInsensitiveDict is not None and isinstance(obj, CaseInsensitiveDict):
+    if CaseInsensitiveDict is not None and isinstance(obj, CaseInsensitiveDict):
         return dict(obj)
-    elif isinstance(obj, MutableMapping):
+    if isinstance(obj, MutableMapping):
         return dict(obj)
     # Nothing known exceptions found. Let msgpack raise its own.
     return obj
@@ -94,11 +94,18 @@ class PyTestEventForwardClient(asyncio.Protocol):
     TCP Client to forward events.
     """
 
-    def __init__(self, connection_lost_future, queue, client_running_event):
-        self.connection_lost_future = connection_lost_future
+    def __init__(self, queue, client_running_event):
         self.queue = queue
-        self.task = None
         self.running = client_running_event
+        self.task = None
+        self.transport = None
+        try:
+            loop = asyncio.get_running_loop()
+        except AttributeError:
+            # Python < 3.7
+            loop = asyncio.get_event_loop()
+        self._connected = loop.create_future()
+        self._disconnected = loop.create_future()
 
     def connection_made(self, transport):
         """
@@ -106,30 +113,45 @@ def connection_made(self, transport):
         """
         peername = transport.get_extra_info("peername")
         log.debug("%s: Connected to %s", self.__class__.__name__, peername)
+        self._connected.set_result(True)
         # pylint: disable=attribute-defined-outside-init
         self.transport = transport
         loop = asyncio.get_running_loop()
         self.task = loop.create_task(self._process_queue())
         # pylint: enable=attribute-defined-outside-init
 
-    def connection_lost(self, exc):
+    def connection_lost(self, exc):  # noqa: ARG002
         """
         Connection lost.
         """
         log.debug("%s: The server closed the connection", self.__class__.__name__)
-        self.connection_lost_future.set_result(True)
+        self._disconnected.set_result(True)
         if self.task is not None:
             self.task.cancel()
 
+    async def wait_connected(self):
+        """
+        Wait until a connection to the server is successful.
+        """
+        return await self._connected
+
+    async def wait_disconnected(self):
+        """
+        Wait until disconnected from the server.
+        """
+        return await self._disconnected
+
     async def _process_queue(self):
         self.running.set()
         log.info("%s: Now processing the queue", self.__class__.__name__)
         restarts = 0
+        max_restarts = 10
         while True:
-            if restarts > 10:
+            if restarts > max_restarts:
+                self._disconnected.set_result(True)
                 break
             if not self.running.is_set():
-                self.connection_lost_future.set_result(True)
+                self._disconnected.set_result(True)
                 break
             try:
                 try:
@@ -144,11 +166,10 @@ async def _process_queue(self):
                 log.debug("%s: forwarded event: %r", self.__class__.__name__, payload)
             except asyncio.CancelledError:
                 break
-            except Exception as exc:  # pylint: disable=broad-except
+            except Exception:  # pylint: disable=broad-except
                 log.exception(
-                    "%s: Caught exception while pulling data from queue: %s",
+                    "%s: Caught exception while pulling data from queue",
                     self.__class__.__name__,
-                    exc,
                 )
                 restarts += 1
 
@@ -196,14 +217,13 @@ def _run_loop_in_thread(self, loop):
             loop.close()
 
     async def _run_client(self, loop):
-        on_con_lost = loop.create_future()
         log.debug(
             "%s client connecting to %s:%s",
             self.__class__.__name__,
             self.returner_address_host,
             self.returner_address_port,
         )
-        self.client = PyTestEventForwardClient(on_con_lost, self.queue, self.client_running_event)
+        self.client = PyTestEventForwardClient(self.queue, self.client_running_event)
         transport, _ = await loop.create_connection(
             lambda: self.client,
             self.returner_address_host,
@@ -212,10 +232,16 @@ async def _run_client(self, loop):
         # Wait until the protocol signals that the connection
         # is lost and close the transport.
         try:
-            log.info("%s client started", self.__class__.__name__)
-            await on_con_lost
-        finally:
+            await asyncio.wait_for(self.client.wait_connected(), timeout=15)
+        except asyncio.TimeoutError:
+            log.error("The client failed to connect to the server after 15 seconds")  # noqa: TRY400
             transport.close()
+        else:
+            try:
+                log.info("%s client started", self.__class__.__name__)
+                await self.client.wait_disconnected()
+            finally:
+                transport.close()
 
     def __repr__(self):  # noqa: D105
         return "<{} role={!r} id={!r}, returner_address='{}:{}' running={!r}>".format(
@@ -242,7 +268,8 @@ def start(self):
         while True:
             log.info("Waiting for %s.client to start...", self.__class__.__name__)
             if time.time() > timeout_at:
-                raise Exception("Failed to start client")
+                msg = "Failed to start client"
+                raise RuntimeError(msg)
             if self.client is None:
                 time.sleep(1)
                 continue
diff --git a/src/saltfactories/utils/saltext/log_handlers/pytest_log_handler.py b/src/saltfactories/utils/saltext/log_handlers/pytest_log_handler.py
index fac81fae..29e79a57 100644
--- a/src/saltfactories/utils/saltext/log_handlers/pytest_log_handler.py
+++ b/src/saltfactories/utils/saltext/log_handlers/pytest_log_handler.py
@@ -21,8 +21,8 @@
     from salt._logging.mixins import ExcInfoOnLogLevelFormatMixin
 except ImportError:  # pragma: no cover
     # This likely due to running backwards compatibility tests against older minions
-    from salt.log.setup import LOG_LEVELS
     from salt.log.mixins import ExcInfoOnLogLevelFormatMixIn as ExcInfoOnLogLevelFormatMixin
+    from salt.log.setup import LOG_LEVELS
 
 
 try:
@@ -84,12 +84,11 @@ def setup_handlers():
     pytest_config = __opts__[pytest_key]
     log_opts = pytest_config["log"]
     if log_opts.get("disabled"):
-        return
+        return None
     host_addr = log_opts.get("host")
     if not host_addr:
-
         if log_opts["pytest_windows_guest"] is True:
-            proc = subprocess.Popen("ipconfig", stdout=subprocess.PIPE)
+            proc = subprocess.Popen("ipconfig", stdout=subprocess.PIPE)  # noqa: S603,S607
             for line in proc.stdout.read().strip().encode(__salt_system_encoding__).splitlines():
                 if "Default Gateway" in line:
                     parts = line.split()
@@ -97,8 +96,8 @@ def setup_handlers():
                     break
         else:
             proc = subprocess.Popen(
-                "netstat -rn | grep -E '^0.0.0.0|default' | awk '{ print $2 }'",
-                shell=True,
+                "netstat -rn | grep -E '^0.0.0.0|default' | awk '{ print $2 }'",  # noqa: S607
+                shell=True,  # noqa: S602
                 stdout=subprocess.PIPE,
             )
             host_addr = proc.stdout.read().strip().encode(__salt_system_encoding__)
@@ -109,7 +108,7 @@ def setup_handlers():
     except OSError as exc:
         # Don't even bother if we can't connect
         log.warning("Cannot connect back to log server at %s:%d: %s", host_addr, host_port, exc)
-        return
+        return None
     finally:
         sock.close()
 
@@ -141,7 +140,7 @@ class ZMQHandler(ExcInfoOnLogLevelFormatMixin, logging.Handler):
     def __init__(
         self, host="127.0.0.1", port=3330, log_prefix=None, level=logging.NOTSET, socket_hwm=100000
     ):
-        super(ZMQHandler, self).__init__(level=level)
+        super().__init__(level=level)
         self.host = host
         self.port = port
         self._log_prefix = log_prefix
@@ -163,16 +162,18 @@ def _set_formatter(self, fmt):
             self.setFormatter(fmt)
 
     def _del_formatter(self):
-        raise RuntimeError("Cannot delete the 'formatter' attribute")
+        msg = "Cannot delete the 'formatter' attribute"
+        raise RuntimeError(msg)
 
     # We set formatter as a property to make it immutable
     formatter = property(_get_formatter, _set_formatter, _del_formatter)
 
-    def setFormatter(self, _):
+    def setFormatter(self, _):  # noqa: N802
         """
         Overridden method to show an error.
         """
-        raise RuntimeError("Do not set a formatter on {}".format(self.__class__.__name__))
+        msg = "Do not set a formatter on {}".format(self.__class__.__name__)
+        raise RuntimeError(msg)
 
     def __getstate__(self):  # noqa: D105
         return {
@@ -195,7 +196,7 @@ def __repr__(self):  # noqa: D105
 
     def _get_log_prefix(self, log_prefix):
         if log_prefix is None:
-            return
+            return None
         if sys.argv[0] == sys.executable:
             cli_arg_idx = 1
         else:
@@ -301,11 +302,11 @@ def stop(self, flush=True):
                 self.context = None
             self.pid = None
 
-    def format(self, record):
+    def format(self, record):  # noqa: A003
         """
         Format the log record.
         """
-        msg = super(ZMQHandler, self).format(record)
+        msg = super().format(record)
         if self.log_prefix:
             msg = "[{}] {}".format(to_unicode(self.log_prefix), to_unicode(msg))
         return msg
diff --git a/tests/.ruff.toml b/tests/.ruff.toml
new file mode 100644
index 00000000..8f04a46e
--- /dev/null
+++ b/tests/.ruff.toml
@@ -0,0 +1,5 @@
+extend = "../pyproject.toml"
+[mccabe]
+max-complexity = 20
+[pylint]
+max-statements = 100
diff --git a/tests/conftest.py b/tests/conftest.py
index 94b0d539..8fbacc41 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -43,17 +43,17 @@ def pkg_version_info(package):
 else:
 
     @pytest.fixture
-    def pytester():
+    def pytester():  # noqa: PT004
         pytest.skip("The pytester fixture is not available in Pytest < 6.2.0")
 
 
 def pytest_report_header():
-    return "salt-version: {}".format(salt.version.__version__)
+    return f"salt-version: {salt.version.__version__}"
 
 
 class Tempfiles:
     """
-    Class which generates temporary files and cleans them when done
+    Class which generates temporary files and cleans them when done.
     """
 
     def __init__(self, request):
@@ -61,7 +61,7 @@ def __init__(self, request):
 
     def makepyfile(self, contents, prefix=None, executable=False):
         """
-        Creates a python file and returns it's path
+        Creates a python file and returns it's path.
         """
         tfile = tempfile.NamedTemporaryFile("w", prefix=prefix or "tmp", suffix=".py", delete=False)
         contents = textwrap.dedent(contents.lstrip("\n")).strip()
@@ -82,7 +82,7 @@ def makepyfile(self, contents, prefix=None, executable=False):
 
     def makeslsfile(self, contents, name=None):
         """
-        Creates an sls file and returns it's path
+        Creates an sls file and returns it's path.
         """
         if name is None:
             tfile = tempfile.NamedTemporaryFile("w", suffix=".sls", delete=False)
@@ -102,7 +102,7 @@ def makeslsfile(self, contents, name=None):
 
     def _delete_temp_file(self, fpath):
         """
-        Cleanup the temporary path
+        Cleanup the temporary path.
         """
         if os.path.exists(fpath):
             os.unlink(fpath)
@@ -111,7 +111,7 @@ def _delete_temp_file(self, fpath):
 @pytest.fixture
 def tempfiles(request):
     """
-    Temporary files fixture
+    Temporary files fixture.
     """
     return Tempfiles(request)
 
diff --git a/tests/functional/factories/base/test_salt_daemon_factory.py b/tests/functional/factories/base/test_salt_daemon_factory.py
index 70d8d62a..33b6e337 100644
--- a/tests/functional/factories/base/test_salt_daemon_factory.py
+++ b/tests/functional/factories/base/test_salt_daemon_factory.py
@@ -25,7 +25,7 @@ def master_id():
 def config_file(config_dir, master_id):
     config_file = str(config_dir / "config")
     with open(config_file, "w", encoding="utf-8") as wfh:
-        wfh.write("id: {}\n".format(master_id))
+        wfh.write(f"id: {master_id}\n")
     return config_file
 
 
@@ -34,19 +34,19 @@ def test_extra_cli_arguments_after_first_failure(
 ):
     """
     This test asserts that after the first start failure, the extra_cli_arguments_after_first_start_failure
-    arguments are added
+    arguments are added.
     """
     output_file = tmp_path.joinpath("output.txt").resolve()
     config = {"conf_file": config_file, "id": master_id}
     script = tempfiles.makepyfile(
-        r"""
+        rf"""
         # coding=utf-8
 
         import sys
         import multiprocessing
 
         def main():
-            with open(r"{}", "a", encoding="utf-8") as wfh:
+            with open(r"{output_file}", "a", encoding="utf-8") as wfh:
                 wfh.write(" ".join(sys.argv))
                 wfh.write("\n")
             sys.exit(1)
@@ -55,9 +55,7 @@ def main():
         if __name__ == '__main__':
             multiprocessing.freeze_support()
             main()
-        """.format(
-            output_file
-        ),
+        """,
     )
     daemon = SaltDaemon(
         script_name=script,
@@ -75,8 +73,8 @@ def main():
     str_exc = str(exc.value)
     output_file_contents = output_file.read_text().splitlines()
     expected = [
-        "{} --config-dir={} --log-level=critical".format(script, config_dir),
-        "{} --config-dir={} --log-level=debug".format(script, config_dir),
+        f"{script} --config-dir={config_dir} --log-level=critical",
+        f"{script} --config-dir={config_dir} --log-level=debug",
     ]
     assert output_file_contents == expected
     assert "Returncode: 1" in str_exc
diff --git a/tests/functional/factories/cli/test_call.py b/tests/functional/factories/cli/test_call.py
index cfac4489..160443a7 100644
--- a/tests/functional/factories/cli/test_call.py
+++ b/tests/functional/factories/cli/test_call.py
@@ -8,8 +8,8 @@ def test_version_info(salt_minion, salt_proxy_minion, salt_version):
     cli = salt_minion.salt_call_cli()
     ret = cli.run("--version")
     assert ret.returncode == 0, ret
-    assert ret.stdout.strip() == "{} {}".format(pathlib.Path(cli.script_name).name, salt_version)
+    assert ret.stdout.strip() == f"{pathlib.Path(cli.script_name).name} {salt_version}"
     cli = salt_proxy_minion.salt_call_cli()
     ret = cli.run("--version")
     assert ret.returncode == 0, ret
-    assert ret.stdout.strip() == "{} {}".format(pathlib.Path(cli.script_name).name, salt_version)
+    assert ret.stdout.strip() == f"{pathlib.Path(cli.script_name).name} {salt_version}"
diff --git a/tests/functional/factories/cli/test_cloud.py b/tests/functional/factories/cli/test_cloud.py
index db56cfe1..4ba7b3e2 100644
--- a/tests/functional/factories/cli/test_cloud.py
+++ b/tests/functional/factories/cli/test_cloud.py
@@ -8,4 +8,4 @@ def test_version_info(salt_master, salt_version):
     cli = salt_master.salt_cloud_cli()
     ret = cli.run("--version")
     assert ret.returncode == 0, ret
-    assert ret.stdout.strip() == "{} {}".format(pathlib.Path(cli.script_name).name, salt_version)
+    assert ret.stdout.strip() == f"{pathlib.Path(cli.script_name).name} {salt_version}"
diff --git a/tests/functional/factories/cli/test_cp.py b/tests/functional/factories/cli/test_cp.py
index 4d02bed4..ea1faf1c 100644
--- a/tests/functional/factories/cli/test_cp.py
+++ b/tests/functional/factories/cli/test_cp.py
@@ -8,4 +8,4 @@ def test_version_info(salt_master, salt_version):
     cli = salt_master.salt_cp_cli()
     ret = cli.run("--version")
     assert ret.returncode == 0, ret
-    assert ret.stdout.strip() == "{} {}".format(pathlib.Path(cli.script_name).name, salt_version)
+    assert ret.stdout.strip() == f"{pathlib.Path(cli.script_name).name} {salt_version}"
diff --git a/tests/functional/factories/cli/test_key.py b/tests/functional/factories/cli/test_key.py
index ca832b16..21fad46e 100644
--- a/tests/functional/factories/cli/test_key.py
+++ b/tests/functional/factories/cli/test_key.py
@@ -8,4 +8,4 @@ def test_version_info(salt_master, salt_version):
     cli = salt_master.salt_key_cli()
     ret = cli.run("--version")
     assert ret.returncode == 0, ret
-    assert ret.stdout.strip() == "{} {}".format(pathlib.Path(cli.script_name).name, salt_version)
+    assert ret.stdout.strip() == f"{pathlib.Path(cli.script_name).name} {salt_version}"
diff --git a/tests/functional/factories/cli/test_run.py b/tests/functional/factories/cli/test_run.py
index 9a9784f2..0b25857d 100644
--- a/tests/functional/factories/cli/test_run.py
+++ b/tests/functional/factories/cli/test_run.py
@@ -8,4 +8,4 @@ def test_version_info(salt_master, salt_version):
     cli = salt_master.salt_run_cli()
     ret = cli.run("--version")
     assert ret.returncode == 0, ret
-    assert ret.stdout.strip() == "{} {}".format(pathlib.Path(cli.script_name).name, salt_version)
+    assert ret.stdout.strip() == f"{pathlib.Path(cli.script_name).name} {salt_version}"
diff --git a/tests/functional/factories/cli/test_salt.py b/tests/functional/factories/cli/test_salt.py
index fed26798..06e1ba97 100644
--- a/tests/functional/factories/cli/test_salt.py
+++ b/tests/functional/factories/cli/test_salt.py
@@ -8,4 +8,4 @@ def test_version_info(salt_master, salt_version):
     cli = salt_master.salt_cli()
     ret = cli.run("--version")
     assert ret.returncode == 0, ret
-    assert ret.stdout.strip() == "{} {}".format(pathlib.Path(cli.script_name).name, salt_version)
+    assert ret.stdout.strip() == f"{pathlib.Path(cli.script_name).name} {salt_version}"
diff --git a/tests/functional/factories/cli/test_spm.py b/tests/functional/factories/cli/test_spm.py
index de5e185a..443942ad 100644
--- a/tests/functional/factories/cli/test_spm.py
+++ b/tests/functional/factories/cli/test_spm.py
@@ -32,7 +32,7 @@ def test_version_info(salt_master, salt_version):
     cli = salt_master.salt_spm_cli()
     ret = cli.run("--version")
     assert ret.returncode == 0, ret
-    assert ret.stdout.strip() == "{} {}".format(pathlib.Path(cli.script_name).name, salt_version)
+    assert ret.stdout.strip() == f"{pathlib.Path(cli.script_name).name} {salt_version}"
 
 
 def test_build_and_install(salt_master, spm_formulas_dir):
diff --git a/tests/functional/factories/cli/test_ssh.py b/tests/functional/factories/cli/test_ssh.py
index ac24031d..c1d067f0 100644
--- a/tests/functional/factories/cli/test_ssh.py
+++ b/tests/functional/factories/cli/test_ssh.py
@@ -8,4 +8,4 @@ def test_version_info(salt_master, salt_version):
     cli = salt_master.salt_ssh_cli()
     ret = cli.run("--version")
     assert ret.returncode == 0, ret
-    assert ret.stdout.strip() == "{} {}".format(pathlib.Path(cli.script_name).name, salt_version)
+    assert ret.stdout.strip() == f"{pathlib.Path(cli.script_name).name} {salt_version}"
diff --git a/tests/functional/factories/daemons/test_container_factory.py b/tests/functional/factories/daemons/test_container_factory.py
index d0602140..1fadc2c0 100644
--- a/tests/functional/factories/daemons/test_container_factory.py
+++ b/tests/functional/factories/daemons/test_container_factory.py
@@ -15,7 +15,7 @@ def _connectable_docker_client():
         if not connectable:
             pytest.skip(connectable)
     except docker.errors.DockerException as exc:
-        pytest.skip("Failed to instantiate a docker client: {}".format(exc))
+        pytest.skip(f"Failed to instantiate a docker client: {exc}")
 
 
 @pytest.mark.parametrize("skip_on_pull_failure", [True, False])
diff --git a/tests/functional/factories/daemons/test_master_factory.py b/tests/functional/factories/daemons/test_master_factory.py
index a40c8885..b27e62ef 100644
--- a/tests/functional/factories/daemons/test_master_factory.py
+++ b/tests/functional/factories/daemons/test_master_factory.py
@@ -69,7 +69,7 @@ def test_provide_root_dir(pytester, salt_factories):
 
 
 def configure_kwargs_ids(value):
-    return "configure_kwargs={!r}".format(value)
+    return f"configure_kwargs={value!r}"
 
 
 @pytest.mark.parametrize(
diff --git a/tests/functional/factories/daemons/test_minion_factory.py b/tests/functional/factories/daemons/test_minion_factory.py
index f602a7ed..fa6d342d 100644
--- a/tests/functional/factories/daemons/test_minion_factory.py
+++ b/tests/functional/factories/daemons/test_minion_factory.py
@@ -87,7 +87,7 @@ def test_provide_root_dir(pytester, salt_factories):
 
 
 def configure_kwargs_ids(value):
-    return "configure_kwargs={!r}".format(value)
+    return f"configure_kwargs={value!r}"
 
 
 @pytest.mark.parametrize(
diff --git a/tests/functional/factories/daemons/test_proxy_minion_factory.py b/tests/functional/factories/daemons/test_proxy_minion_factory.py
index e6e49963..d18eb0cf 100644
--- a/tests/functional/factories/daemons/test_proxy_minion_factory.py
+++ b/tests/functional/factories/daemons/test_proxy_minion_factory.py
@@ -53,7 +53,7 @@ def test_provide_root_dir(pytester, salt_factories):
 
 
 def configure_kwargs_ids(value):
-    return "configure_kwargs={!r}".format(value)
+    return f"configure_kwargs={value!r}"
 
 
 @pytest.mark.parametrize(
diff --git a/tests/functional/factories/daemons/test_syndic_factory.py b/tests/functional/factories/daemons/test_syndic_factory.py
index b76ea0c7..7eaf7cf3 100644
--- a/tests/functional/factories/daemons/test_syndic_factory.py
+++ b/tests/functional/factories/daemons/test_syndic_factory.py
@@ -106,7 +106,7 @@ def test_provide_root_dir(pytester, mom):
 
 
 def configure_kwargs_ids(value):
-    return "configure_kwargs={!r}".format(value)
+    return f"configure_kwargs={value!r}"
 
 
 @pytest.mark.parametrize(
diff --git a/tests/functional/loader/test_fixture_deps.py b/tests/functional/loader/test_fixture_deps.py
index d8a3ab51..dc671aa6 100644
--- a/tests/functional/loader/test_fixture_deps.py
+++ b/tests/functional/loader/test_fixture_deps.py
@@ -15,7 +15,7 @@
 
 
 @pytest.fixture(autouse=True)
-def confirm_saltfactories_does_not_have_salt_dunders():
+def _confirm_saltfactories_does_not_have_salt_dunders():
     assert (
         HAS_SALT_DUNDER is False
     ), "Weirdly, the saltfactories module has a __salt__ dunder defined. That's a bug!"
@@ -33,7 +33,7 @@ def confirm_saltfactories_does_not_have_salt_dunders_after_setup_loader_mock_ter
 def pre_loader_modules_patched_fixture():
     with pytest.raises(AttributeError):
         assert isinstance(saltfactories.__salt__, dict)  # pylint: disable=no-member
-    yield False
+    return False
 
 
 @pytest.fixture
@@ -46,7 +46,7 @@ def configure_loader_modules(pre_loader_modules_patched_fixture):
 
 
 @pytest.fixture
-def fixture_that_needs_loader_modules_patched():
+def _fixture_that_needs_loader_modules_patched():
     assert saltfactories.__salt__["foo"] is False  # pylint: disable=no-member
     with patch.dict(saltfactories.__salt__, {"foo": True}):  # pylint: disable=no-member
         assert saltfactories.__salt__["foo"] is True  # pylint: disable=no-member
@@ -54,6 +54,7 @@ def fixture_that_needs_loader_modules_patched():
     assert saltfactories.__salt__["foo"] is False  # pylint: disable=no-member
 
 
-def test_fixture_deps(fixture_that_needs_loader_modules_patched):
+@pytest.mark.usefixtures("_fixture_that_needs_loader_modules_patched")
+def test_fixture_deps():
     assert saltfactories.__salt__["foo"] is True  # pylint: disable=no-member
     assert saltfactories.__salt__["test.echo"]("foo") == "foo"  # pylint: disable=no-member
diff --git a/tests/functional/loader/test_loader.py b/tests/functional/loader/test_loader.py
index 066c0dae..fb3eda9a 100644
--- a/tests/functional/loader/test_loader.py
+++ b/tests/functional/loader/test_loader.py
@@ -109,23 +109,21 @@ def test_one():
 @pytest.mark.parametrize("dunder", ["__virtual__", "__init__"])
 def test_runtime_error_raised_when_not_needed_dunders_are_passed(pytester, dunder):
     pytester.makepyfile(
-        """
+        f"""
         import pytest
         import string
 
         @pytest.fixture
         def configure_loader_modules():
-            return {{string: {{"{}": False}}}}
+            return {{string: {{"{dunder}": False}}}}
 
         def test_one():
             assert True
-        """.format(
-            dunder
-        )
+        """
     )
     res = pytester.runpytest()
     res.assert_outcomes(errors=1)
-    res.stdout.fnmatch_lines(["*UsageError: No need to patch '{}'*".format(dunder)])
+    res.stdout.fnmatch_lines([f"*UsageError: No need to patch '{dunder}'*"])
 
 
 def test_runtime_error_raised_on_unknown_salt_dunders(pytester):
diff --git a/tests/functional/test_cli.py b/tests/functional/test_cli.py
index 221ab9a5..45aa24d9 100644
--- a/tests/functional/test_cli.py
+++ b/tests/functional/test_cli.py
@@ -23,11 +23,11 @@ def cmdline_ids(value):
 )
 def test_salt_factories_cli(cmdline):
     if not shutil.which(cmdline[0]):
-        pytest.skip("binary {} not found".format(cmdline[0]))
+        pytest.skip(f"binary {cmdline[0]} not found")
     ret = subprocess.run(
         cmdline,
         stdout=subprocess.PIPE,
-        universal_newlines=True,
+        text=True,
         check=False,
     )
     assert ret.returncode == 0
@@ -45,12 +45,11 @@ def test_salt_factories_cli(cmdline):
 )
 def test_salt_factories_cli_show_help(cmdline):
     if not shutil.which(cmdline[0]):
-        pytest.skip("binary {} not found".format(cmdline[0]))
+        pytest.skip(f"binary {cmdline[0]} not found")
     ret = subprocess.run(
         cmdline,
-        stdout=subprocess.PIPE,
-        stderr=subprocess.PIPE,
-        universal_newlines=True,
+        capture_output=True,
+        text=True,
         check=False,
     )
     assert ret.returncode == 1
diff --git a/tests/functional/test_manager.py b/tests/functional/test_manager.py
index b1ad8240..0446f64b 100644
--- a/tests/functional/test_manager.py
+++ b/tests/functional/test_manager.py
@@ -20,7 +20,7 @@ def _python_excutable_ids(value):
 def test_python_executable_cli(pytester, python_executable):
     args = []
     if python_executable:
-        args.append("--python-executable={}".format(python_executable))
+        args.append(f"--python-executable={python_executable}")
 
     pytester.makepyfile(
         """
@@ -56,17 +56,15 @@ def test_master(salt_factories):
         )
     )
     pytester.makeconftest(
-        """
+        f"""
         import pytest
 
         @pytest.fixture(scope="session")
         def salt_factories_config():
             return {{
-                "python_executable": {!r}
+                "python_executable": {python_executable!r}
             }}
-        """.format(
-            python_executable
-        )
+        """
     )
     res = pytester.runpytest_subprocess()
     res.assert_outcomes(passed=2)
@@ -83,17 +81,15 @@ def scripts_dir(tmp_path):
 
 def test_scripts_dir_cli(pytester, scripts_dir):
     pytester.makeconftest(
-        """
+        f"""
         import pytest
 
         @pytest.fixture(scope="session")
         def salt_factories_config():
             return {{
-                "python_executable": {!r}
+                "python_executable": {sys.executable!r}
             }}
-        """.format(
-            sys.executable
-        )
+        """
     )
     pytester.makepyfile(
         """
@@ -112,24 +108,22 @@ def test_master(salt_factories):
         )
     )
 
-    res = pytester.runpytest_subprocess("--scripts-dir={}".format(scripts_dir))
+    res = pytester.runpytest_subprocess(f"--scripts-dir={scripts_dir}")
     res.assert_outcomes(passed=3)
 
 
 def test_scripts_dir_config_fixture(pytester, scripts_dir):
     pytester.makeconftest(
-        """
+        f"""
         import pytest
 
         @pytest.fixture(scope="session")
         def salt_factories_config():
             return {{
-                "scripts_dir": r'{}',
-                "python_executable": '{}',
+                "scripts_dir": r'{scripts_dir}',
+                "python_executable": '{sys.executable}',
             }}
-        """.format(
-            scripts_dir, sys.executable
-        )
+        """
     )
     pytester.makepyfile(
         """
@@ -153,7 +147,7 @@ def test_master(salt_factories):
 
 
 def _system_service_ids(value):
-    return "system-service({})".format(value)
+    return f"system-service({value})"
 
 
 @pytest.mark.parametrize("system_service", [True, False], ids=_system_service_ids)
@@ -193,19 +187,16 @@ def test_master(salt_factories):
 @pytest.mark.parametrize("system_service", [True, False], ids=_system_service_ids)
 def test_system_service_config_fixture(pytester, system_service, tmp_path):
     pytester.makeconftest(
-        """
+        f"""
         import pytest
 
         @pytest.fixture(scope="session")
         def salt_factories_config():
             return {{
-                "root_dir": r'{}',
-                "system_service": {},
+                "root_dir": r'{tmp_path}',
+                "system_service": {system_service},
             }}
-        """.format(
-            tmp_path,
-            system_service,
-        )
+        """
     )
     args = []
     if system_service:
diff --git a/tests/functional/utils/saltext/test_log_handlers.py b/tests/functional/utils/saltext/test_log_handlers.py
index aa0c03d8..98f6a37a 100644
--- a/tests/functional/utils/saltext/test_log_handlers.py
+++ b/tests/functional/utils/saltext/test_log_handlers.py
@@ -13,7 +13,7 @@ def test_handler_does_not_block_when_not_connected(tempfiles):
     log_forwarding_socket_hwm = 5
     shell = ScriptSubprocess(script_name=sys.executable, timeout=10)
     script = tempfiles.makepyfile(
-        """
+        f"""
         # coding=utf-8
         import sys
         import time
@@ -32,7 +32,7 @@ def test_handler_does_not_block_when_not_connected(tempfiles):
         )
 
         # Add our ZMQ handler, it should not block even though it does not connect anywhere
-        handler = ZMQHandler(port=123456, socket_hwm={})
+        handler = ZMQHandler(port=123456, socket_hwm={log_forwarding_socket_hwm})
         logging.root.addHandler(handler)
 
         def main():
@@ -47,14 +47,12 @@ def main():
         if __name__ == '__main__':
             multiprocessing.freeze_support()
             main()
-        """.format(
-            log_forwarding_socket_hwm
-        )
+        """
     )
     try:
         result = shell.run(script)
     except FactoryTimeout as exc:  # pragma: no cover
-        pytest.fail("The ZMQHandler blocked. Process result:\n{}".format(exc))
+        pytest.fail(f"The ZMQHandler blocked. Process result:\n{exc}")
     # If the exitcode is not 0, that means the script was forcefully terminated, which,
     # in turn means the ZMQHandler blocked the process when not connected to the log
     # listener.
@@ -63,7 +61,7 @@ def main():
     # Since we set a HWM of log_forwarding_socket_hwm, we should at least see
     # Foo {log_forwarding_socket_hwm + 1} logged to the console.
     # If we don't, the handler blocked the process
-    assert "Foo {}".format(log_forwarding_socket_hwm + 1) in result.stderr
+    assert f"Foo {log_forwarding_socket_hwm + 1}" in result.stderr
     assert result.returncode == 0
 
 
@@ -72,7 +70,7 @@ def test_all_messages_received(tempfiles, salt_factories, caplog):
     log_forwarding_calls = log_forwarding_socket_hwm * 2
     shell = ScriptSubprocess(script_name=sys.executable, timeout=10)
     script = tempfiles.makepyfile(
-        """
+        f"""
         # coding=utf-8
         import sys
         import time
@@ -91,13 +89,13 @@ def test_all_messages_received(tempfiles, salt_factories, caplog):
         )
 
         # Add our ZMQ handler
-        handler = ZMQHandler(port={}, socket_hwm={})
+        handler = ZMQHandler(port={salt_factories.log_server_port}, socket_hwm={log_forwarding_socket_hwm})
         logging.root.addHandler(handler)
 
         def main():
             log = logging.getLogger("foo")
             print("Logging started", flush=True)
-            for idx in range(1, {} + 1):
+            for idx in range(1, {log_forwarding_calls} + 1):
                 log.debug("Foo:%s", idx)
             print("Logging finished", flush=True)
             exit(0)
@@ -105,21 +103,19 @@ def main():
         if __name__ == '__main__':
             multiprocessing.freeze_support()
             main()
-        """.format(
-            salt_factories.log_server_port, log_forwarding_socket_hwm, log_forwarding_calls
-        )
+        """
     )
     with caplog.at_level(logging.DEBUG, logger="foo"):
         try:
             result = shell.run(script)
         except FactoryTimeout as exc:  # pragma: no cover
-            pytest.fail("The ZMQHandler blocked. Process result:\n{}".format(exc))
+            pytest.fail(f"The ZMQHandler blocked. Process result:\n{exc}")
         # If the exitcode is not 0, that means the script was forcefully terminated, which,
         # in turn means the ZMQHandler blocked the process when not connected to the log
         # listener.
         assert "Logging started" in result.stdout
         assert "Logging finished" in result.stdout
-        expected_log_message = "Foo:{}".format(log_forwarding_calls)
+        expected_log_message = f"Foo:{log_forwarding_calls}"
         assert expected_log_message in result.stderr
         assert result.returncode == 0
 
@@ -140,9 +136,7 @@ def main():
             try:
                 assert (
                     len(found_log_messages) == log_forwarding_calls
-                ), "len(found_log_messages={}) != {} // Missed: {}".format(
-                    len(found_log_messages), log_forwarding_calls, missed
-                )
+                ), f"len(found_log_messages={len(found_log_messages)}) != {log_forwarding_calls} // Missed: {missed}"
                 break
             except AssertionError:  # pragma: no cover
                 if datetime.utcnow() > timeout:
@@ -155,11 +149,9 @@ def test_all_messages_received_multiprocessing(tempfiles, salt_factories, caplog
     # ZMQHandler and continue logging
     if fork_method == "fork":
         if pytestskipmarkers.utils.platform.is_windows():
-            pytest.skip("Start method '{}' is not supported on Windows".format(fork_method))
+            pytest.skip(f"Start method '{fork_method}' is not supported on Windows")
         if sys.version_info >= (3, 8) and pytestskipmarkers.utils.platform.is_darwin():
-            pytest.skip(
-                "Start method '{}' is not supported on Darwin on Py3.8+".format(fork_method)
-            )
+            pytest.skip(f"Start method '{fork_method}' is not supported on Darwin on Py3.8+")
     num_processes = 2
     log_forwarding_calls = 10
     shell = ScriptSubprocess(script_name=sys.executable, timeout=30)
@@ -259,7 +251,7 @@ def main():
         try:
             result = shell.run(script)
         except FactoryTimeout as exc:  # pragma: no cover
-            pytest.fail("The ZMQHandler blocked. Process result:\n{}".format(exc))
+            pytest.fail(f"The ZMQHandler blocked. Process result:\n{exc}")
         # If the exitcode is not 0, that means the script was forcefully terminated, which,
         # in turn means the ZMQHandler blocked the process when not connected to the log
         # listener.
diff --git a/tests/functional/utils/test_tempfiles.py b/tests/functional/utils/test_tempfiles.py
index ec4f1fcc..98ce7e12 100644
--- a/tests/functional/utils/test_tempfiles.py
+++ b/tests/functional/utils/test_tempfiles.py
@@ -139,7 +139,7 @@ def test_saltenvs_temp_file(tmp_path):
             with saltenv.base.temp_file(  # pylint: disable=no-member
                 "top.sls", contents=top_file_contents
             ) as top_file_path:
-                with pytest.raises(ValueError):
+                with pytest.raises(ValueError):  # noqa: PT011
                     # the top file shall not be created within the base_env_path_2
                     # We have to cast to a string because on Py3.5, the path might be an instance of pathlib2.Path
                     top_file_path.relative_to(str(base_env_path_2))
diff --git a/tests/integration/factories/cli/test_salt.py b/tests/integration/factories/cli/test_salt.py
index 9c4fdb01..ee437af2 100644
--- a/tests/integration/factories/cli/test_salt.py
+++ b/tests/integration/factories/cli/test_salt.py
@@ -28,5 +28,5 @@ def test_merged_json_out_disabled(salt_cli, salt_minion, salt_minion_2):
     ret = salt_cli.run("test.ping", minion_tgt="*", merge_json_output=False)
     assert ret.returncode == 0, ret
     assert not ret.data
-    assert '"{}": true'.format(salt_minion.id) in ret.stdout
-    assert '"{}": true'.format(salt_minion_2.id) in ret.stdout
+    assert f'"{salt_minion.id}": true' in ret.stdout
+    assert f'"{salt_minion_2.id}": true' in ret.stdout
diff --git a/tests/integration/factories/daemons/container/test_container_factory.py b/tests/integration/factories/daemons/container/test_container_factory.py
index f4a92eaf..fd02fa61 100644
--- a/tests/integration/factories/daemons/container/test_container_factory.py
+++ b/tests/integration/factories/daemons/container/test_container_factory.py
@@ -24,7 +24,7 @@ def docker_container(salt_factories, docker_client, echo_server_port):
         docker_client=docker_client,
         check_ports=[echo_server_port],
         container_run_kwargs={
-            "ports": {"{}/tcp".format(echo_server_port): echo_server_port},
+            "ports": {f"{echo_server_port}/tcp": echo_server_port},
             "environment": {"TCP_PORT": str(echo_server_port), "NODE_NAME": "echo-server-test"},
         },
     )
diff --git a/tests/integration/factories/daemons/container/test_minion.py b/tests/integration/factories/daemons/container/test_minion.py
index e5ca9208..0cf4cdfc 100644
--- a/tests/integration/factories/daemons/container/test_minion.py
+++ b/tests/integration/factories/daemons/container/test_minion.py
@@ -1,6 +1,5 @@
 import logging
 
-import _pytest._version
 import pytest
 
 from saltfactories.daemons.container import SaltMinion
@@ -12,7 +11,6 @@
 
 log = logging.getLogger(__name__)
 
-PYTEST_GE_7 = getattr(_pytest._version, "version_tuple", (-1, -1)) >= (7, 0)
 
 pytestmark = [
     # We can't pass ``extra_cli_arguments_after_first_start_failure``, but this is solvable,
@@ -27,12 +25,8 @@
 @pytest.fixture(scope="session")
 def docker_client(salt_factories, docker_client):
     if salt_factories.system_service:
-        exc_kwargs = {}
-        if PYTEST_GE_7:
-            exc_kwargs["_use_item_location"] = True
-        raise pytest.skip.Exception(
-            "Test should not run against system install of Salt", **exc_kwargs
-        )
+        msg = "Test should not run against system install of Salt"
+        raise pytest.skip.Exception(msg, _use_item_location=True)
     return docker_client
 
 
@@ -65,17 +59,17 @@ def host_docker_network_ip_address(docker_client):
 @pytest.fixture(scope="session")
 def salt_factories_config(salt_factories_config, host_docker_network_ip_address):
     """
-    Return a dictionary with the keyword arguments for FactoriesManager
+    Return a dictionary with the keyword arguments for FactoriesManager.
     """
     config = salt_factories_config.copy()
     config["log_server_host"] = host_docker_network_ip_address
     return config
 
 
-@pytest.fixture(scope="function")
+@pytest.fixture()
 def minion_id(salt_version):
     return random_string(
-        "salt-{}-".format(salt_version),
+        f"salt-{salt_version}-",
         uppercase=False,
     )
 
@@ -106,7 +100,10 @@ def salt_minion(
     config_overrides = {
         "master": salt_master.config["interface"],
         "user": False,
-        "pytest-minion": {"log": {"host": host_docker_network_ip_address}},
+        "pytest-minion": {
+            "log": {"host": host_docker_network_ip_address},
+            "returner_address": {"host": host_docker_network_ip_address},
+        },
         # We also want to scrutinize the key acceptance
         "open_mode": False,
     }
@@ -117,7 +114,7 @@ def salt_minion(
         extra_cli_arguments_after_first_start_failure=["--log-level=debug"],
         # SaltMinion kwargs
         name=minion_id,
-        image="ghcr.io/saltstack/salt-ci-containers/salt:3004",
+        image="ghcr.io/saltstack/salt-ci-containers/salt:3005",
         docker_client=docker_client,
         start_timeout=120,
         pull_before_start=False,
diff --git a/tests/integration/factories/daemons/master/test_master.py b/tests/integration/factories/daemons/master/test_master.py
index 648781d0..cea0b095 100644
--- a/tests/integration/factories/daemons/master/test_master.py
+++ b/tests/integration/factories/daemons/master/test_master.py
@@ -61,7 +61,7 @@ def test_salt_run(master, salt_run):
 
 def test_salt_cp_minion_id_as_first_argument(master, minion, salt_cp, tempfiles, tmp_path):
     """
-    Test copying a file from the master any minions connected
+    Test copying a file from the master any minions connected.
     """
     dest = tmp_path / "copied-file.txt"
     contents = "id: foo"
@@ -77,7 +77,7 @@ def test_salt_cp_minion_id_as_first_argument(master, minion, salt_cp, tempfiles,
 
 def test_salt_cp_explicit_minion_tgt(master, minion, salt_cp, tempfiles, tmp_path):
     """
-    Test copying a file from the master to the minion
+    Test copying a file from the master to the minion.
     """
     dest = tmp_path / "copied-file.txt"
     contents = "id: foo"
diff --git a/tests/integration/factories/daemons/minion/test_event_forwarder_engine.py b/tests/integration/factories/daemons/minion/test_event_forwarder_engine.py
index a6c6420d..c6620e76 100644
--- a/tests/integration/factories/daemons/minion/test_event_forwarder_engine.py
+++ b/tests/integration/factories/daemons/minion/test_event_forwarder_engine.py
@@ -31,7 +31,8 @@ def salt_call_cli(minion):
 def test_event_listener_engine(minion, salt_call_cli, event_listener):
     """
     There are some events which the minion fires internally that never reach the master.
-    We test if we're receiving those
+
+    We test if we're receiving those.
     """
     assert minion.is_running()
     start_time = time.time()
diff --git a/tests/integration/factories/daemons/minion/test_minion.py b/tests/integration/factories/daemons/minion/test_minion.py
index f2799cea..90dde8dc 100644
--- a/tests/integration/factories/daemons/minion/test_minion.py
+++ b/tests/integration/factories/daemons/minion/test_minion.py
@@ -61,7 +61,11 @@ def test_minion_salt_call(minion, salt_call_cli):
 
 def test_salt_call_exception_handling_doesnt_timeout(minion, salt_call_cli):
     ret = salt_call_cli.run(
-        "test.raise_exception", "OSError", "2", "No such file or directory", "/tmp/foo.txt"
+        "test.raise_exception",
+        "OSError",
+        "2",
+        "No such file or directory",
+        "/tmp/foo.txt",  # noqa: S108
     )
     assert ret.returncode == 1, ret
 
diff --git a/tests/integration/factories/daemons/proxy/test_proxy_minion.py b/tests/integration/factories/daemons/proxy/test_proxy_minion.py
index 579e6f50..52ff0cea 100644
--- a/tests/integration/factories/daemons/proxy/test_proxy_minion.py
+++ b/tests/integration/factories/daemons/proxy/test_proxy_minion.py
@@ -68,7 +68,7 @@ def test_proxy_minion_salt_call(proxy_minion, salt_call_cli):
     assert ret.returncode == 0, ret
     assert ret.data is True
     # Now with --local
-    ret = salt_call_cli.run("--proxyid={}".format(proxy_minion.id), "test.ping")
+    ret = salt_call_cli.run(f"--proxyid={proxy_minion.id}", "test.ping")
     assert ret.returncode == 0, ret
     assert ret.data is True
 
diff --git a/tests/integration/factories/daemons/ssh/test_salt_ssh.py b/tests/integration/factories/daemons/ssh/test_salt_ssh.py
index 832a2d37..6b19de13 100644
--- a/tests/integration/factories/daemons/ssh/test_salt_ssh.py
+++ b/tests/integration/factories/daemons/ssh/test_salt_ssh.py
@@ -29,15 +29,13 @@ def salt_ssh_cli(sshd, salt_factories, master):
     roster_file_path = salt_factories.tmp_root_dir / "salt_ssh_roster"
     with open(str(roster_file_path), "w", encoding="utf-8") as wfh:
         contents = textwrap.dedent(
-            """\
+            f"""\
         localhost:
           host: 127.0.0.1
-          port: {}
+          port: {sshd.listen_port}
           mine_functions:
             test.arg: ['itworked']
-        """.format(
-                sshd.listen_port
-            )
+        """
         )
         wfh.write(contents)
         log.debug("Wrote '%s' with contents:\n%s", roster_file_path, contents)
diff --git a/tests/integration/factories/daemons/sshd/test_sshd.py b/tests/integration/factories/daemons/sshd/test_sshd.py
index 3b425fc9..5a99125c 100644
--- a/tests/integration/factories/daemons/sshd/test_sshd.py
+++ b/tests/integration/factories/daemons/sshd/test_sshd.py
@@ -1,3 +1,4 @@
+import shutil
 import subprocess
 
 import pytest
@@ -22,9 +23,11 @@ def test_sshd(sshd):
 @pytest.mark.skip_on_windows
 @pytest.mark.skip_if_binaries_missing("ssh")
 def test_connect(sshd):
+    ssh = shutil.which("ssh")
+    assert ssh is not None
     cmd = subprocess.run(
         [
-            "ssh",
+            ssh,
             "-i",
             str(sshd.client_key),
             "-p",
@@ -36,9 +39,8 @@ def test_connect(sshd):
             sshd.listen_address,
             "echo Foo",
         ],
-        stdout=subprocess.PIPE,
-        stderr=subprocess.PIPE,
-        universal_newlines=True,
+        capture_output=True,
+        text=True,
         check=False,
     )
     assert cmd.returncode == 0, cmd
diff --git a/tests/scenarios/examples/conftest.py b/tests/scenarios/examples/conftest.py
index 660f621e..f0dbf9cd 100644
--- a/tests/scenarios/examples/conftest.py
+++ b/tests/scenarios/examples/conftest.py
@@ -2,6 +2,7 @@
 
 import attr
 import pytest
+import importlib_metadata
 
 from saltfactories import CODE_ROOT_DIR
 from saltfactories.utils.virtualenv import VirtualEnv
@@ -28,11 +29,17 @@ def __enter__(self):  # noqa: D105
         self.venv.__enter__()
         self.venv.run("git", "init", ".")
         self.venv.run("git", "add", ".")
+
+        import salt.version  # pylint: disable=import-outside-toplevel
+
+        self.venv.install(f"salt=={salt.version.__saltstack_version__}")
+        self.venv.install(f"pytest=={importlib_metadata.version('pytest')}")
         self.venv.install(str(CODE_ROOT_DIR.parent.parent))
-        # Salt(3003) doesn't yet support pyzmq 21.0.x
-        self.venv.install("pyzmq<21.0.0")
-        # Only Salt >= 3006 supports importlib-metadata>=5.0.0
-        self.venv.install("importlib-metadata<5.0.0", ".[tests]")
+
+        if salt.version.__saltstack_version__ < "3006":
+            # Only Salt >= 3006 supports importlib-metadata>=5.0.0
+            self.venv.install("importlib-metadata<5.0.0")
+        self.venv.install(".[tests]")
         return self.venv
 
     def __exit__(self, *_):  # noqa: D105
diff --git a/tests/scenarios/examples/test_echoext.py b/tests/scenarios/examples/test_echoext.py
index 238a442b..9114d8b1 100644
--- a/tests/scenarios/examples/test_echoext.py
+++ b/tests/scenarios/examples/test_echoext.py
@@ -4,5 +4,13 @@
 def test_echoext(extension_venv):
     extension_path = CODE_ROOT_DIR.parent.parent / "examples" / "echo-extension"
     with extension_venv(extension_path) as venv:
-        ret = venv.run(venv.venv_python, "-m", "pytest", str(extension_path), check=False)
+        ret = venv.run(
+            venv.venv_python,
+            "-m",
+            "pytest",
+            "-o",
+            f"testpaths={extension_path}",
+            str(extension_path),
+            check=False,
+        )
         assert ret.returncode == 0
diff --git a/tests/unit/factories/base/test_salt_cli_factory.py b/tests/unit/factories/base/test_salt_cli_factory.py
index f1a276db..cea4d419 100644
--- a/tests/unit/factories/base/test_salt_cli_factory.py
+++ b/tests/unit/factories/base/test_salt_cli_factory.py
@@ -29,7 +29,7 @@ def minion_id():
 def config_file(config_dir, minion_id):
     config_file = str(config_dir / "config")
     with open(config_file, "w", encoding="utf-8") as wfh:
-        wfh.write("id: {}\n".format(minion_id))
+        wfh.write(f"id: {minion_id}\n")
     return config_file
 
 
@@ -52,7 +52,7 @@ def test_default_cli_flags(minion_id, config_dir, config_file, cli_script_name):
     kwargs = {"minion_tgt": minion_id}
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
@@ -76,17 +76,15 @@ def test_override_log_level(minion_id, config_dir, config_file, cli_script_name,
     args.extend(flag_overrides_args)
     args.append("test.ping")
     kwargs = {"minion_tgt": minion_id}
-    expected = (
-        [
-            cli_script_name,
-            "--config-dir={}".format(config_dir),
-            "--out=json",
-            "--out-indent=0",
-            minion_id,
-        ]
-        + flag_overrides_args
-        + ["test.ping"]
-    )
+    expected = [
+        cli_script_name,
+        f"--config-dir={config_dir}",
+        "--out=json",
+        "--out-indent=0",
+        minion_id,
+        *flag_overrides_args,
+        "test.ping",
+    ]
     proc = SaltCli(script_name=cli_script_name, config=config)
     cmdline = proc.cmdline(*args, **kwargs)
     assert cmdline == expected
@@ -104,16 +102,14 @@ def test_override_output(minion_id, config_dir, config_file, cli_script_name, fl
     args.extend(flag_overrides_args)
     args.append("test.ping")
     kwargs = {"minion_tgt": minion_id}
-    expected = (
-        [
-            cli_script_name,
-            "--config-dir={}".format(config_dir),
-            "--log-level=critical",
-            minion_id,
-        ]
-        + flag_overrides_args
-        + ["test.ping"]
-    )
+    expected = [
+        cli_script_name,
+        f"--config-dir={config_dir}",
+        "--log-level=critical",
+        minion_id,
+        *flag_overrides_args,
+        "test.ping",
+    ]
     proc = SaltCli(script_name=cli_script_name, config=config)
     cmdline = proc.cmdline(*args, **kwargs)
     assert cmdline == expected
@@ -133,17 +129,15 @@ def test_override_output_indent(minion_id, config_dir, config_file, cli_script_n
     args.extend(flag_overrides_args)
     args.append("test.ping")
     kwargs = {"minion_tgt": minion_id}
-    expected = (
-        [
-            cli_script_name,
-            "--config-dir={}".format(config_dir),
-            "--out=json",
-            "--log-level=critical",
-            minion_id,
-        ]
-        + flag_overrides_args
-        + ["test.ping"]
-    )
+    expected = [
+        cli_script_name,
+        f"--config-dir={config_dir}",
+        "--out=json",
+        "--log-level=critical",
+        minion_id,
+        *flag_overrides_args,
+        "test.ping",
+    ]
     proc = SaltCli(script_name=cli_script_name, config=config)
     cmdline = proc.cmdline(*args, **kwargs)
     assert cmdline == expected
@@ -160,7 +154,7 @@ def test_cli_timeout_lesser_than_timeout_kw(minion_id, config_dir, config_file,
     kwargs = {"minion_tgt": minion_id, "_timeout": explicit_timeout}
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
@@ -202,7 +196,7 @@ def test_cli_timeout_matches_timeout_kw(minion_id, config_dir, config_file, cli_
     kwargs = {"minion_tgt": minion_id, "_timeout": explicit_timeout}
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
@@ -244,7 +238,7 @@ def test_cli_timeout_greater_than_timeout_kw(minion_id, config_dir, config_file,
     kwargs = {"minion_tgt": minion_id, "_timeout": explicit_timeout}
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
@@ -286,8 +280,8 @@ def test_cli_timeout_updates_to_timeout_kw_plus_default_increase(
     kwargs = {"minion_tgt": minion_id, "_timeout": explicit_timeout}
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
-        "--timeout={}".format(explicit_timeout),
+        f"--config-dir={config_dir}",
+        f"--timeout={explicit_timeout}",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
@@ -326,8 +320,8 @@ def test_cli_timeout_updates_to_default_timeout_plus_default_increase(
     kwargs = {"minion_tgt": minion_id}
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
-        "--timeout={}".format(timeout),
+        f"--config-dir={config_dir}",
+        f"--timeout={timeout}",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
@@ -366,20 +360,18 @@ def test_override_timeout(minion_id, config_dir, config_file, cli_script_name, f
 
     timeout = 10
     config = {"conf_file": config_file, "id": "the-id"}
-    args = flag_overrides_args + ["test.ping"]
+    args = [*flag_overrides_args, "test.ping"]
     kwargs = {"minion_tgt": minion_id}
-    expected = (
-        [
-            cli_script_name,
-            "--config-dir={}".format(config_dir),
-            "--out=json",
-            "--out-indent=0",
-            "--log-level=critical",
-            minion_id,
-        ]
-        + flag_overrides_args
-        + ["test.ping"]
-    )
+    expected = [
+        cli_script_name,
+        f"--config-dir={config_dir}",
+        "--out=json",
+        "--out-indent=0",
+        "--log-level=critical",
+        minion_id,
+        *flag_overrides_args,
+        "test.ping",
+    ]
     proc = SaltCli(script_name=cli_script_name, config=config, timeout=timeout)
     # We set __cli_timeout_supported__ to True just to test. This would be an attribute set
     # at the class level for Salt CLI's that support the timeout flag, like for example, salt-run
@@ -404,20 +396,18 @@ def test_override_timeout_bad_value(minion_id, config_dir, config_file, cli_scri
 
     timeout = 10
     config = {"conf_file": config_file, "id": "the-id"}
-    args = flag_overrides_args + ["test.ping"]
+    args = [*flag_overrides_args, "test.ping"]
     kwargs = {"minion_tgt": minion_id}
-    expected = (
-        [
-            cli_script_name,
-            "--config-dir={}".format(config_dir),
-            "--out=json",
-            "--out-indent=0",
-            "--log-level=critical",
-            minion_id,
-        ]
-        + flag_overrides_args
-        + ["test.ping"]
-    )
+    expected = [
+        cli_script_name,
+        f"--config-dir={config_dir}",
+        "--out=json",
+        "--out-indent=0",
+        "--log-level=critical",
+        minion_id,
+        *flag_overrides_args,
+        "test.ping",
+    ]
     proc = SaltCli(script_name=cli_script_name, config=config, timeout=timeout)
     # We set __cli_timeout_supported__ to True just to test. This would be an attribute set
     # at the class level for Salt CLI's that support the timeout flag, like for example, salt-run
@@ -434,28 +424,26 @@ def test_override_timeout_bad_value(minion_id, config_dir, config_file, cli_scri
 
 @pytest.mark.parametrize("flag", ["-c", "--config-dir", "--config-dir=", None])
 def test_override_config_dir(minion_id, config_dir, config_file, cli_script_name, flag):
-    passed_config_dir = "{}.new".format(config_dir)
+    passed_config_dir = f"{config_dir}.new"
     if flag is None:
-        flag_overrides_args = ["--config-dir={}".format(config_dir)]
+        flag_overrides_args = [f"--config-dir={config_dir}"]
     elif flag.endswith("="):
         flag_overrides_args = [flag + passed_config_dir]
     else:
         flag_overrides_args = [flag, passed_config_dir]
 
     config = {"conf_file": config_file, "id": "the-id"}
-    args = flag_overrides_args + ["test.ping"]
+    args = [*flag_overrides_args, "test.ping"]
     kwargs = {"minion_tgt": minion_id}
-    expected = (
-        [
-            cli_script_name,
-            "--out=json",
-            "--out-indent=0",
-            "--log-level=critical",
-            minion_id,
-        ]
-        + flag_overrides_args
-        + ["test.ping"]
-    )
+    expected = [
+        cli_script_name,
+        "--out=json",
+        "--out-indent=0",
+        "--log-level=critical",
+        minion_id,
+        *flag_overrides_args,
+        "test.ping",
+    ]
     proc = SaltCli(script_name=cli_script_name, config=config)
     cmdline = proc.cmdline(*args, **kwargs)
     assert cmdline == expected
@@ -482,13 +470,13 @@ def test_non_string_cli_flags(minion_id, config_dir, config_file, cli_script_nam
     kwargs = {"minion_tgt": minion_id, "foo": foo}
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
         minion_id,
         "test.ping",
-        "foo={}".format(json.dumps(foo)),
+        f"foo={json.dumps(foo)}",
     ]
     proc = SaltCli(script_name=cli_script_name, config=config)
     cmdline = proc.cmdline(*args, **kwargs)
@@ -504,7 +492,7 @@ def test_jsonify_kwargs(minion_id, config_dir, config_file, cli_script_name):
     kwargs.update(extra_kwargs)
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
@@ -512,7 +500,7 @@ def test_jsonify_kwargs(minion_id, config_dir, config_file, cli_script_name):
         "test.ping",
     ]
     for key, value in extra_kwargs.items():
-        expected.append("{}={}".format(key, value))
+        expected.append(f"{key}={value}")
     proc = SaltCli(script_name=cli_script_name, config=config)
     cmdline = proc.cmdline(*args, **kwargs)
     # Function **kwargs are not ordered dictionaries on some python versions
@@ -525,16 +513,16 @@ def test_jsonify_kwargs(minion_id, config_dir, config_file, cli_script_name):
     kwargs.update(extra_kwargs)
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
         minion_id,
         "test.ping",
     ]
-    for key, value in extra_kwargs.items():
-        value = json.dumps(value)
-        expected.append("{}={}".format(key, value))
+    for key, _value in extra_kwargs.items():
+        value = json.dumps(_value)
+        expected.append(f"{key}={value}")
     proc = SaltCli(script_name=cli_script_name, config=config)
     cmdline = proc.cmdline(*args, **kwargs)
     # Function **kwargs are not ordered dictionaries on some python versions
@@ -547,16 +535,16 @@ def test_jsonify_kwargs(minion_id, config_dir, config_file, cli_script_name):
     kwargs.update(extra_kwargs)
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
         minion_id,
         "test.ping",
     ]
-    for key, value in extra_kwargs.items():
-        value = json.dumps(value)
-        expected.append("{}={}".format(key, value))
+    for key, _value in extra_kwargs.items():
+        value = json.dumps(_value)
+        expected.append(f"{key}={value}")
     proc = SaltCli(script_name=cli_script_name, config=config)
     cmdline = proc.cmdline(*args, **kwargs)
     # Function **kwargs are not ordered dictionaries on some python versions
@@ -568,13 +556,13 @@ def test_jsonify_kwargs(minion_id, config_dir, config_file, cli_script_name):
     kwargs = {"minion_tgt": minion_id, "extra": extra_kwargs}
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
         minion_id,
         "test.ping",
-        "extra={}".format(json.dumps(extra_kwargs)),
+        f"extra={json.dumps(extra_kwargs)}",
     ]
     proc = SaltCli(script_name=cli_script_name, config=config)
     cmdline = proc.cmdline(*args, **kwargs)
@@ -585,7 +573,7 @@ def test_jsonify_kwargs(minion_id, config_dir, config_file, cli_script_name):
 
 def test_salt_cli_factory_id_attr_comes_first_in_repr(config_file):
     proc = SaltCli(script_name="foo-bar", config={"id": "TheID", "conf_file": config_file})
-    regex = r"{}(id='TheID'".format(proc.__class__.__name__)
+    regex = rf"{proc.__class__.__name__}(id='TheID'"
     assert repr(proc).startswith(regex)
     assert str(proc).startswith(regex)
 
@@ -593,4 +581,4 @@ def test_salt_cli_factory_id_attr_comes_first_in_repr(config_file):
 def test_salt_cli_display_name(config_file):
     factory_id = "TheID"
     proc = SaltCli(script_name="foo-bar", config={"id": factory_id, "conf_file": config_file})
-    assert proc.get_display_name() == "{}(id={!r})".format(SaltCli.__name__, factory_id)
+    assert proc.get_display_name() == f"{SaltCli.__name__}(id={factory_id!r})"
diff --git a/tests/unit/factories/base/test_salt_daemon_factory.py b/tests/unit/factories/base/test_salt_daemon_factory.py
index 5a8f9a6f..c5ece7ce 100644
--- a/tests/unit/factories/base/test_salt_daemon_factory.py
+++ b/tests/unit/factories/base/test_salt_daemon_factory.py
@@ -23,7 +23,7 @@ def master_id():
 def config_file(config_dir, master_id):
     config_file = str(config_dir / "config")
     with open(config_file, "w", encoding="utf-8") as wfh:
-        wfh.write("id: {}\n".format(master_id))
+        wfh.write(f"id: {master_id}\n")
     return config_file
 
 
@@ -44,7 +44,7 @@ def test_default_cli_flags(config_dir, config_file, cli_script_name):
     config = {"conf_file": config_file, "id": "the-id"}
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--log-level=critical",
     ]
     proc = SaltDaemon(start_timeout=1, script_name=cli_script_name, config=config)
@@ -60,10 +60,7 @@ def test_override_log_level(config_dir, config_file, cli_script_name, flag):
     else:
         args = [flag, "info"]
 
-    expected = [
-        cli_script_name,
-        "--config-dir={}".format(config_dir),
-    ] + args
+    expected = [cli_script_name, f"--config-dir={config_dir}", *args]
     proc = SaltDaemon(start_timeout=1, script_name=cli_script_name, config=config)
     cmdline = proc.cmdline(*args)
     assert cmdline == expected
@@ -71,16 +68,16 @@ def test_override_log_level(config_dir, config_file, cli_script_name, flag):
 
 @pytest.mark.parametrize("flag", ["-c", "--config-dir", "--config-dir=", None])
 def test_override_config_dir(config_dir, config_file, cli_script_name, flag):
-    passed_config_dir = "{}.new".format(config_dir)
+    passed_config_dir = f"{config_dir}.new"
     if flag is None:
-        args = ["--config-dir={}".format(config_dir)]
+        args = [f"--config-dir={config_dir}"]
     elif flag.endswith("="):
         args = [flag + passed_config_dir]
     else:
         args = [flag, passed_config_dir]
 
     config = {"conf_file": config_file, "id": "the-id"}
-    expected = [cli_script_name, "--log-level=critical"] + args
+    expected = [cli_script_name, "--log-level=critical", *args]
     proc = SaltDaemon(start_timeout=1, script_name=cli_script_name, config=config)
     cmdline = proc.cmdline(*args)
     assert cmdline == expected
@@ -90,7 +87,7 @@ def test_salt_daemon_factory_id_attr_comes_first_in_repr(config_file):
     proc = SaltDaemon(
         start_timeout=1, script_name="foo-bar", config={"id": "TheID", "conf_file": config_file}
     )
-    regex = r"{}(id='TheID'".format(proc.__class__.__name__)
+    regex = rf"{proc.__class__.__name__}(id='TheID'"
     assert repr(proc).startswith(regex)
     assert str(proc).startswith(regex)
 
@@ -102,4 +99,4 @@ def test_salt_cli_display_name(config_file):
         script_name="foo-bar",
         config={"id": factory_id, "conf_file": config_file},
     )
-    assert proc.get_display_name() == "{}(id={!r})".format(SaltDaemon.__name__, factory_id)
+    assert proc.get_display_name() == f"{SaltDaemon.__name__}(id={factory_id!r})"
diff --git a/tests/unit/factories/cli/test_salt.py b/tests/unit/factories/cli/test_salt.py
index 883ec132..1e86f476 100644
--- a/tests/unit/factories/cli/test_salt.py
+++ b/tests/unit/factories/cli/test_salt.py
@@ -26,7 +26,7 @@ def minion_id():
 def config_file(config_dir, minion_id):
     config_file = str(config_dir / "config")
     with open(config_file, "w", encoding="utf-8") as wfh:
-        wfh.write("id: {}\n".format(minion_id))
+        wfh.write(f"id: {minion_id}\n")
     return config_file
 
 
@@ -59,18 +59,16 @@ def test_missing_minion_id_does_not_raise_exception(
     minion_id, config_dir, config_file, cli_script_name, flag
 ):
     """
-    Assert that certain flag, which just output something and then exit, don't raise an exception
+    Assert that certain flag, which just output something and then exit, don't raise an exception.
     """
     config = {"conf_file": config_file, "id": "the-id"}
-    args = ["test.ping"] + [flag]
+    args = ["test.ping", flag]
     proc = Salt(script_name=cli_script_name, config=config)
     try:
         proc.cmdline(*args)
     except RuntimeError:
         pytest.fail(
-            "The Salt class raised RuntimeError when the CLI flag '{}' was present in args".format(
-                flag
-            )
+            f"The Salt class raised RuntimeError when the CLI flag '{flag}' was present in args"
         )
 
 
@@ -85,13 +83,14 @@ def test_default_timeout_config(minion_id, config_dir, config_file, cli_script_n
     proc = Salt(script_name=cli_script_name, config=config)
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--timeout=15",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
         minion_id,
-    ] + ["test.ping"]
+        "test.ping",
+    ]
     cmdline = proc.cmdline(*args, minion_tgt=minion_id)
     assert cmdline == expected
 
@@ -105,12 +104,13 @@ def test_default_timeout_construct(minion_id, config_dir, config_file, cli_scrip
     proc = Salt(script_name=cli_script_name, config=config, timeout=15)
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--timeout=15",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
         minion_id,
-    ] + ["test.ping"]
+        "test.ping",
+    ]
     cmdline = proc.cmdline(*args, minion_tgt=minion_id)
     assert cmdline == expected
diff --git a/tests/unit/factories/cli/test_salt_cp.py b/tests/unit/factories/cli/test_salt_cp.py
index 00f494bb..bf4bd14d 100644
--- a/tests/unit/factories/cli/test_salt_cp.py
+++ b/tests/unit/factories/cli/test_salt_cp.py
@@ -26,7 +26,7 @@ def minion_id():
 def config_file(config_dir, minion_id):
     config_file = str(config_dir / "config")
     with open(config_file, "w", encoding="utf-8") as wfh:
-        wfh.write("id: {}\n".format(minion_id))
+        wfh.write(f"id: {minion_id}\n")
     return config_file
 
 
@@ -54,13 +54,14 @@ def test_default_timeout_config(minion_id, config_dir, config_file, cli_script_n
     proc = SaltCp(script_name=cli_script_name, config=config)
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--timeout=15",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
         minion_id,
-    ] + ["test.ping"]
+        "test.ping",
+    ]
     cmdline = proc.cmdline(*args, minion_tgt=minion_id)
     assert cmdline == expected
 
@@ -74,12 +75,13 @@ def test_default_timeout_construct(minion_id, config_dir, config_file, cli_scrip
     proc = SaltCp(script_name=cli_script_name, config=config, timeout=15)
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--timeout=15",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
         minion_id,
-    ] + ["test.ping"]
+        "test.ping",
+    ]
     cmdline = proc.cmdline(*args, minion_tgt=minion_id)
     assert cmdline == expected
diff --git a/tests/unit/factories/cli/test_salt_run.py b/tests/unit/factories/cli/test_salt_run.py
index 9df2f031..c5316048 100644
--- a/tests/unit/factories/cli/test_salt_run.py
+++ b/tests/unit/factories/cli/test_salt_run.py
@@ -26,7 +26,7 @@ def minion_id():
 def config_file(config_dir, minion_id):
     config_file = str(config_dir / "config")
     with open(config_file, "w", encoding="utf-8") as wfh:
-        wfh.write("id: {}\n".format(minion_id))
+        wfh.write(f"id: {minion_id}\n")
     return config_file
 
 
@@ -54,12 +54,13 @@ def test_default_timeout_config(minion_id, config_dir, config_file, cli_script_n
     proc = SaltRun(script_name=cli_script_name, config=config)
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--timeout=15",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
-    ] + ["test.ping"]
+        "test.ping",
+    ]
     cmdline = proc.cmdline(*args)
     assert cmdline == expected
 
@@ -73,11 +74,12 @@ def test_default_timeout_construct(minion_id, config_dir, config_file, cli_scrip
     proc = SaltRun(script_name=cli_script_name, config=config, timeout=15)
     expected = [
         cli_script_name,
-        "--config-dir={}".format(config_dir),
+        f"--config-dir={config_dir}",
         "--timeout=15",
         "--out=json",
         "--out-indent=0",
         "--log-level=critical",
-    ] + ["test.ping"]
+        "test.ping",
+    ]
     cmdline = proc.cmdline(*args)
     assert cmdline == expected
diff --git a/tests/unit/utils/test_cli_scripts.py b/tests/unit/utils/test_cli_scripts.py
index b4f6b58d..e52fa999 100644
--- a/tests/unit/utils/test_cli_scripts.py
+++ b/tests/unit/utils/test_cli_scripts.py
@@ -7,12 +7,12 @@
 
 import pytest
 
-import saltfactories.utils.cli_scripts as cli_scripts
+from saltfactories.utils import cli_scripts
 
 
 def test_generate_script_defaults(tmpdir):
     """
-    Test defaults script generation
+    Test defaults script generation.
     """
     script_path = cli_scripts.generate_script(tmpdir.strpath, "salt-foobar")
     with open(script_path, encoding="utf-8") as rfh:
@@ -71,7 +71,7 @@ def main():
 
 def test_generate_script_code_dir(tmpdir):
     """
-    Test code_dir inclusion in script generation
+    Test code_dir inclusion in script generation.
     """
     code_dir = tmpdir.mkdir("code-dir").strpath
     script_path = cli_scripts.generate_script(tmpdir.strpath, "salt-foobar", code_dir=code_dir)
@@ -79,7 +79,7 @@ def test_generate_script_code_dir(tmpdir):
         contents = rfh.read()
 
     expected = textwrap.dedent(
-        """\
+        f"""\
         from __future__ import absolute_import
         import os
         import sys
@@ -89,7 +89,7 @@ def test_generate_script_code_dir(tmpdir):
         # Don't write .pyc files or create them in __pycache__ directories
         os.environ[str("PYTHONDONTWRITEBYTECODE")] = str("1")
 
-        CODE_DIR = r'{}'
+        CODE_DIR = r'{code_dir}'
         if CODE_DIR in sys.path:
             sys.path.remove(CODE_DIR)
         sys.path.insert(0, CODE_DIR)
@@ -129,16 +129,14 @@ def main():
             sys.stderr.flush()
             atexit._run_exitfuncs()
             os._exit(exitcode)
-        """.format(
-            code_dir
-        )
+        """
     )
     assert contents == expected
 
 
 def test_generate_script_coverage_support_usage_error_1(tmp_path):
     """
-    Test coverage related code included in script generation
+    Test coverage related code included in script generation.
     """
     # If only one of coverage_rc_path or coverage_db_path is passed, we fail
     with pytest.raises(pytest.UsageError):
@@ -149,7 +147,7 @@ def test_generate_script_coverage_support_usage_error_1(tmp_path):
 
 def test_generate_script_coverage_support_usage_error_2(tmp_path):
     """
-    Test coverage related code included in script generation
+    Test coverage related code included in script generation.
     """
     with pytest.raises(pytest.UsageError):
         cli_scripts.generate_script(
@@ -159,7 +157,7 @@ def test_generate_script_coverage_support_usage_error_2(tmp_path):
 
 def test_generate_script_coverage_support(tmp_path):
     """
-    Test coverage related code included in script generation
+    Test coverage related code included in script generation.
     """
     coverage_rc_path = tmp_path / ".coveragerc"
     coverage_db_path = tmp_path / ".coverage"
@@ -173,7 +171,7 @@ def test_generate_script_coverage_support(tmp_path):
         contents = rfh.read()
 
     expected = textwrap.dedent(
-        """\
+        f"""\
         from __future__ import absolute_import
         import os
         import sys
@@ -184,8 +182,8 @@ def test_generate_script_coverage_support(tmp_path):
         os.environ[str("PYTHONDONTWRITEBYTECODE")] = str("1")
 
         # Setup coverage environment variables
-        COVERAGE_FILE = r'{coverage_db_path}'
-        COVERAGE_PROCESS_START = r'{coverage_rc_path}'
+        COVERAGE_FILE = r'{coverage_db_path!s}'
+        COVERAGE_PROCESS_START = r'{coverage_rc_path!s}'
         os.environ[str('COVERAGE_FILE')] = str(COVERAGE_FILE)
         os.environ[str('COVERAGE_PROCESS_START')] = str(COVERAGE_PROCESS_START)
 
@@ -224,17 +222,14 @@ def main():
             sys.stderr.flush()
             atexit._run_exitfuncs()
             os._exit(exitcode)
-        """.format(
-            coverage_rc_path=str(coverage_rc_path),
-            coverage_db_path=str(coverage_db_path),
-        )
+        """
     )
     assert contents == expected
 
 
 def test_generate_script_inject_sitecustomize(tmp_path):
     """
-    Test sitecustomize injection related code included in script generation
+    Test sitecustomize injection related code included in script generation.
     """
     sitecustomize_path = pathlib.Path(cli_scripts.__file__).resolve().parent / "coverage"
     coverage_rc_path = tmp_path / ".coveragerc"
@@ -250,7 +245,7 @@ def test_generate_script_inject_sitecustomize(tmp_path):
         contents = rfh.read()
 
     expected = textwrap.dedent(
-        """\
+        f"""\
         from __future__ import absolute_import
         import os
         import sys
@@ -261,13 +256,13 @@ def test_generate_script_inject_sitecustomize(tmp_path):
         os.environ[str("PYTHONDONTWRITEBYTECODE")] = str("1")
 
         # Setup coverage environment variables
-        COVERAGE_FILE = r'{coverage_db_path}'
-        COVERAGE_PROCESS_START = r'{coverage_rc_path}'
+        COVERAGE_FILE = r'{coverage_db_path!s}'
+        COVERAGE_PROCESS_START = r'{coverage_rc_path!s}'
         os.environ[str('COVERAGE_FILE')] = str(COVERAGE_FILE)
         os.environ[str('COVERAGE_PROCESS_START')] = str(COVERAGE_PROCESS_START)
 
         # Allow sitecustomize.py to be importable for test coverage purposes
-        SITECUSTOMIZE_DIR = r'{}'
+        SITECUSTOMIZE_DIR = r'{sitecustomize_path!s}'
         PYTHONPATH = os.environ.get('PYTHONPATH') or None
         if PYTHONPATH is None:
             PYTHONPATH_ENV_VAR = SITECUSTOMIZE_DIR
@@ -317,11 +312,7 @@ def main():
             sys.stderr.flush()
             atexit._run_exitfuncs()
             os._exit(exitcode)
-        """.format(
-            str(sitecustomize_path),
-            coverage_rc_path=str(coverage_rc_path),
-            coverage_db_path=str(coverage_db_path),
-        )
+        """
     )
     assert contents == expected
 
@@ -330,7 +321,7 @@ def main():
         contents = rfh.read()
 
     expected = textwrap.dedent(
-        """\
+        f"""\
         from __future__ import absolute_import
         import os
         import sys
@@ -341,7 +332,7 @@ def main():
         os.environ[str("PYTHONDONTWRITEBYTECODE")] = str("1")
 
         # Allow sitecustomize.py to be importable for test coverage purposes
-        SITECUSTOMIZE_DIR = r'{}'
+        SITECUSTOMIZE_DIR = r'{sitecustomize_path!s}'
         PYTHONPATH = os.environ.get('PYTHONPATH') or None
         if PYTHONPATH is None:
             PYTHONPATH_ENV_VAR = SITECUSTOMIZE_DIR
@@ -391,16 +382,14 @@ def main():
             sys.stderr.flush()
             atexit._run_exitfuncs()
             os._exit(exitcode)
-        """.format(
-            str(sitecustomize_path)
-        )
+        """
     )
     assert contents == expected
 
 
 def test_generate_script_salt(tmpdir):
     """
-    Test script generation for the salt CLI script
+    Test script generation for the salt CLI script.
     """
     script_path = cli_scripts.generate_script(tmpdir.strpath, "salt")
     with open(script_path, encoding="utf-8") as rfh:
@@ -450,7 +439,7 @@ def test_generate_script_salt(tmpdir):
 
 def test_generate_script_salt_api(tmpdir):
     """
-    Test script generation for the salt-api CLI script
+    Test script generation for the salt-api CLI script.
     """
     script_path = cli_scripts.generate_script(tmpdir.strpath, "salt-api")
     with open(script_path, encoding="utf-8") as rfh:
@@ -507,7 +496,7 @@ def main():
 
 def test_generate_script_creates_missing_bin_dir(tmpdir):
     """
-    Test defaults script generation
+    Test defaults script generation.
     """
     script_path = cli_scripts.generate_script(tmpdir.join("blah").strpath, "salt-foobar")
     with open(script_path, encoding="utf-8") as rfh:
@@ -567,7 +556,7 @@ def main():
 
 def test_generate_script_only_generates_once(tmpdir):
     """
-    Test defaults script generation
+    Test defaults script generation.
     """
     script_path = cli_scripts.generate_script(tmpdir.strpath, "salt-foobar")
     with open(script_path, encoding="utf-8") as rfh: