mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 06:30:27 +03:00 
			
		
		
		
	convert tests/testcommon.py to black code format
This commit is contained in:
		
							parent
							
								
									617a9e75c7
								
							
						
					
					
						commit
						261be20109
					
				
					 2 changed files with 8 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -52,7 +52,6 @@ force-exclude = '''(
 | 
			
		|||
  | tests/extra/manual-vmtools-test\.py
 | 
			
		||||
  | tests/gradle-release-checksums\.py
 | 
			
		||||
  | tests/openssl-version-check-test\.py
 | 
			
		||||
  | tests/testcommon\.py
 | 
			
		||||
  | tests/valid-package-names/test\.py
 | 
			
		||||
  | tests/checkupdates\.TestCase
 | 
			
		||||
  | tests/common\.TestCase
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,10 +20,8 @@ import sys
 | 
			
		|||
import tempfile
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TmpCwd():
 | 
			
		||||
    """Context-manager for temporarily changing the current working
 | 
			
		||||
    directory.
 | 
			
		||||
    """
 | 
			
		||||
class TmpCwd:
 | 
			
		||||
    """Context-manager for temporarily changing the current working directory."""
 | 
			
		||||
 | 
			
		||||
    def __init__(self, new_cwd):
 | 
			
		||||
        self.new_cwd = new_cwd
 | 
			
		||||
| 
						 | 
				
			
			@ -36,9 +34,8 @@ class TmpCwd():
 | 
			
		|||
        os.chdir(self.orig_cwd)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TmpPyPath():
 | 
			
		||||
    """Context-manager for temporarily adding a direcory to python path
 | 
			
		||||
    """
 | 
			
		||||
class TmpPyPath:
 | 
			
		||||
    """Context-manager for temporarily adding a directory to Python path."""
 | 
			
		||||
 | 
			
		||||
    def __init__(self, additional_path):
 | 
			
		||||
        self.additional_path = additional_path
 | 
			
		||||
| 
						 | 
				
			
			@ -51,14 +48,11 @@ class TmpPyPath():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def mock_open_to_str(mock):
 | 
			
		||||
    """
 | 
			
		||||
    helper function for accessing all data written into a
 | 
			
		||||
    unittest.mock.mock_open() instance as a string.
 | 
			
		||||
    """
 | 
			
		||||
    """For accessing all data written into a unittest.mock.mock_open() instance as a string."""
 | 
			
		||||
 | 
			
		||||
    return "".join([
 | 
			
		||||
        x.args[0] for x in mock.mock_calls if str(x).startswith("call().write(")
 | 
			
		||||
    ])
 | 
			
		||||
    return "".join(
 | 
			
		||||
        [x.args[0] for x in mock.mock_calls if str(x).startswith("call().write(")]
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def mkdtemp():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue