mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 06:30:27 +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
				
			
		| 
						 | 
				
			
			@ -70,7 +70,10 @@ class NightlyTest(unittest.TestCase):
 | 
			
		|||
 | 
			
		||||
    def tearDown(self):
 | 
			
		||||
        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):
 | 
			
		||||
        self.dot_android.mkdir()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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