tests: Use yaml.full_load when available.
Per <https://msg.pyyaml.org/load>.
This commit is contained in:
		
							parent
							
								
									ab8559c75b
								
							
						
					
					
						commit
						1e381664f4
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -14,9 +14,14 @@ from import2ledger import importers, strparse
 | 
			
		|||
 | 
			
		||||
from . import DATA_DIR
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
    load_yaml = yaml.full_load
 | 
			
		||||
except AttributeError:
 | 
			
		||||
    load_yaml = yaml.load
 | 
			
		||||
 | 
			
		||||
class TestImporters:
 | 
			
		||||
    with pathlib.Path(DATA_DIR, 'imports.yml').open() as yaml_file:
 | 
			
		||||
        test_data = yaml.load(yaml_file)
 | 
			
		||||
        test_data = load_yaml(yaml_file)
 | 
			
		||||
    for test in test_data:
 | 
			
		||||
        test['source'] = DATA_DIR / test['source']
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue