Added docstrings and test for updater.find_datafiles
This commit is contained in:
		
							
								
								
									
										16
									
								
								test/test_module.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								test/test_module.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
import os
 | 
			
		||||
import pytest
 | 
			
		||||
import updater
 | 
			
		||||
from unittest import mock
 | 
			
		||||
 | 
			
		||||
@pytest.mark.parametrize("system", [("Windows", "Linux", "Darwin")])
 | 
			
		||||
def test_find_datafiles(system):
 | 
			
		||||
    with mock.patch("platform.system", return_value=system):
 | 
			
		||||
        result = updater.find_datafiles()
 | 
			
		||||
        if system == "Windows":
 | 
			
		||||
            assert "bootstrap.exe" in result[0][1]
 | 
			
		||||
            assert os.path.exists(result[0][1][0])
 | 
			
		||||
        else:
 | 
			
		||||
            assert len(result[0][1]) == 2
 | 
			
		||||
            assert os.path.exists(result[0][1][0])
 | 
			
		||||
            assert os.path.exists(result[0][1][1])
 | 
			
		||||
@@ -1,8 +1,14 @@
 | 
			
		||||
import glob
 | 
			
		||||
import os.path
 | 
			
		||||
import platform
 | 
			
		||||
from typing import List, Tuple
 | 
			
		||||
 | 
			
		||||
def find_datafiles():
 | 
			
		||||
def find_datafiles() -> List[Tuple[str, List[str]]]:
 | 
			
		||||
    """ Returns path to the updater bootstrap file.
 | 
			
		||||
 | 
			
		||||
    :returns: A tuple of the form ("", ["bootstrap_file"])
 | 
			
		||||
    :rtype: tuple
 | 
			
		||||
    """
 | 
			
		||||
    system = platform.system()
 | 
			
		||||
    if system == 'Windows':
 | 
			
		||||
        file_ext = '*.exe'
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user