refactor(quality): drop imports repeated inside functions
This commit is contained in:
@@ -351,8 +351,6 @@ class TestLongJobLock(unittest.TestCase):
|
||||
self.api = PromptManagerAPI(db=database)
|
||||
|
||||
def _run(self, coro):
|
||||
import asyncio
|
||||
|
||||
return asyncio.run(coro)
|
||||
|
||||
def test_second_acquire_is_refused_until_first_releases(self):
|
||||
@@ -825,8 +823,6 @@ class TestInstanceHelpers(FolderPathsFixture):
|
||||
self.addCleanup(setattr, GalleryConfig, "MONITORING_DIRECTORIES", orig_dirs)
|
||||
|
||||
def _run(self, coro):
|
||||
import asyncio
|
||||
|
||||
return asyncio.run(coro)
|
||||
|
||||
def test_run_in_executor_with_kwargs(self):
|
||||
|
||||
@@ -143,8 +143,6 @@ class TestLibrary(unittest.TestCase):
|
||||
self.db.get_library_positive(positive, variant_limit=201)
|
||||
|
||||
def test_sorts_keysets_survive_anchor_deletion_and_insertions_without_writes(self):
|
||||
import sqlite3
|
||||
|
||||
a = self.save("Alpha", rating=2, tags=["tag"])
|
||||
b = self.save("beta", rating=5)
|
||||
c = self.save("charlie")
|
||||
|
||||
@@ -386,14 +386,9 @@ class GalleryDiagnostics:
|
||||
except ImportError:
|
||||
self.logger.error(" [FAIL] PIL (Pillow): NOT AVAILABLE")
|
||||
|
||||
# Check sqlite3
|
||||
try:
|
||||
import sqlite3
|
||||
|
||||
dependencies["sqlite3"] = True
|
||||
self.logger.info(f" [PASS] sqlite3: {sqlite3.sqlite_version}")
|
||||
except ImportError:
|
||||
self.logger.error(" [FAIL] sqlite3: NOT AVAILABLE")
|
||||
# sqlite3 is imported at the top of this module, so it is always here.
|
||||
dependencies["sqlite3"] = True
|
||||
self.logger.info(f" [PASS] sqlite3: {sqlite3.sqlite_version}")
|
||||
|
||||
all_deps_ok = all(dependencies.values())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user