From f88bb4ed600f9008885d2c4ec819c2cf8f08776a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Tue, 2 Jul 2024 14:32:40 +0100 Subject: [PATCH] Add a shell command which tests for leftover temp files --- pyproject.toml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index be239a0ec..45e7afdc1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -230,6 +230,21 @@ env.OPTS = """ --cov-context=test """ +[tool.poe.tasks.check-temp-files] +help = "Run each test module one by one and check for leftover temp files" +shell = """ +setopt nullglob +for file in test/**/*.py; do + print Temp files created by $file && poe test $file &>/dev/null + tempfiles=(/tmp/**/tmp* /tmp/beets/**/*) + if (( $#tempfiles )); then + print -l $'\t'$^tempfiles + rm -r --interactive=never $tempfiles &>/dev/null + fi +done +""" +interpreter = "zsh" + [tool.black] line-length = 80 target-version = ["py38", "py39", "py310", "py311"]