Add a shell command which tests for leftover temp files

This commit is contained in:
Šarūnas Nejus 2024-07-02 14:32:40 +01:00
parent de704125d8
commit f88bb4ed60
No known key found for this signature in database
GPG key ID: DD28F6704DBE3435

View file

@ -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"]