From 9854b244fd2bf7f0a766143a23a196abd3372605 Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Thu, 5 Oct 2023 12:11:21 -0400 Subject: [PATCH] Fix Flake8 errors by using a pytest conftest.py file. --- tests/backend/ip_adapter/test_ip_adapter.py | 2 +- tests/conftest.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 tests/conftest.py diff --git a/tests/backend/ip_adapter/test_ip_adapter.py b/tests/backend/ip_adapter/test_ip_adapter.py index d8be45bae5..b84f5836be 100644 --- a/tests/backend/ip_adapter/test_ip_adapter.py +++ b/tests/backend/ip_adapter/test_ip_adapter.py @@ -2,7 +2,7 @@ import pytest import torch from invokeai.backend.model_management.models.base import BaseModelType, ModelType, SubModelType -from invokeai.backend.util.test_utils import install_and_load_model, model_installer, slow, torch_device +from invokeai.backend.util.test_utils import install_and_load_model, slow def build_dummy_sd15_unet_input(torch_device): diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000000..8618f5e102 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,6 @@ +# conftest.py is a special pytest file. Fixtures defined in this file will be accessible to all tests in this directory +# without needing to explicitly import them. (https://docs.pytest.org/en/6.2.x/fixture.html) + +# We import the model_installer and torch_device fixtures here so that they can be used by all tests. Flake8 does not +# play well with fixtures (F401 and F811), so this is cleaner than importing in all files that use these fixtures. +from invokeai.backend.util.test_utils import model_installer, torch_device # noqa: F401