Skip to content

Commit

Permalink
test: Close SQLite connections before cleanup on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jul 20, 2024
1 parent 9537716 commit bb2f5f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ def clean(config, setting):
basedir = os.path.realpath(os.path.dirname(os.path.dirname(__file__)))
# Avoid accidentally deleting directories outside the project.
assert os.path.commonprefix((directory, basedir)) == basedir
from glob import glob

print(glob(os.path.join(directory, "**", "*"))) # noqa: T201
if os.path.exists(directory):
shutil.rmtree(directory)
7 changes: 6 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from scrapyd import Config
from scrapyd.app import application
from scrapyd.utils import get_spider_queues
from scrapyd.website import Root
from tests import clean, root_add_version

Expand All @@ -26,7 +27,11 @@ def root(request):

yield Root(config, app)

for setting in ("dbs_dir", "eggs_dir"):
print(list(get_spider_queues(config))) # noqa: T201
for spiderqueue in get_spider_queues(config).values():
spiderqueue.q.conn.close()

for setting in ("eggs_dir", "dbs_dir"):
clean(config, setting)


Expand Down

0 comments on commit bb2f5f8

Please sign in to comment.