mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-14 02:50:12 +01: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
@ -70,7 +70,10 @@ class NightlyTest(unittest.TestCase):
|
|||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.tempdir.cleanup()
|
self.tempdir.cleanup()
|
||||||
os.rmdir(self.testroot)
|
try:
|
||||||
|
os.rmdir(self.testroot)
|
||||||
|
except OSError: # other test modules might have left stuff around
|
||||||
|
pass
|
||||||
|
|
||||||
def _copy_test_debug_keystore(self):
|
def _copy_test_debug_keystore(self):
|
||||||
self.dot_android.mkdir()
|
self.dot_android.mkdir()
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
class TmpCwd:
|
class TmpCwd:
|
||||||
@ -60,3 +63,12 @@ def mkdtemp():
|
|||||||
return tempfile.TemporaryDirectory()
|
return tempfile.TemporaryDirectory()
|
||||||
else:
|
else:
|
||||||
return tempfile.TemporaryDirectory(ignore_cleanup_errors=True)
|
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…
Reference in New Issue
Block a user