mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
make it easy to keep test artifacts from jobs
When troubleshooting things that are difficult to reproduce locally, like different behaviors in the fedora_latest job, these changes make it easy to keep the test files around after the tests run. For example, if PNGs are processed differently by newer Python versions.
This commit is contained in:
parent
299e3e5f4c
commit
1b65e33835
2 changed files with 16 additions and 1 deletions
|
@ -18,6 +18,9 @@
|
|||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class TmpCwd:
|
||||
|
@ -60,3 +63,12 @@ def mkdtemp():
|
|||
return tempfile.TemporaryDirectory()
|
||||
else:
|
||||
return tempfile.TemporaryDirectory(ignore_cleanup_errors=True)
|
||||
|
||||
|
||||
def mkdir_testfiles(localmodule, test):
|
||||
"""Keep the test files in a labeled test dir for easy reference"""
|
||||
testroot = Path(localmodule) / '.testfiles'
|
||||
testroot.mkdir(exist_ok=True)
|
||||
testdir = testroot / unittest.TestCase.id(test)
|
||||
testdir.mkdir(exist_ok=True)
|
||||
return tempfile.mkdtemp(dir=testdir)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue