tests: Make clean_account_meta a teardown fixture.
This commit is contained in:
		
							parent
							
								
									df0c3546fd
								
							
						
					
					
						commit
						87e715df7c
					
				
					 2 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
					@ -286,7 +286,7 @@ def test_is_account(account_s):
 | 
				
			||||||
    'Income:Donations',
 | 
					    'Income:Donations',
 | 
				
			||||||
    'Liabilities:CreditCard:Visa0123',
 | 
					    'Liabilities:CreditCard:Visa0123',
 | 
				
			||||||
])
 | 
					])
 | 
				
			||||||
def test_is_account(clean_account_meta, account_s):
 | 
					def test_is_account(account_s):
 | 
				
			||||||
    assert data.Account.is_account(account_s)
 | 
					    assert data.Account.is_account(account_s)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@pytest.mark.parametrize('account_s', [
 | 
					@pytest.mark.parametrize('account_s', [
 | 
				
			||||||
| 
						 | 
					@ -298,7 +298,7 @@ def test_is_account(clean_account_meta, account_s):
 | 
				
			||||||
    'Expenses:Banking_Fees',
 | 
					    'Expenses:Banking_Fees',
 | 
				
			||||||
    'Revenue:Grants',
 | 
					    'Revenue:Grants',
 | 
				
			||||||
])
 | 
					])
 | 
				
			||||||
def test_is_not_account(clean_account_meta, account_s):
 | 
					def test_is_not_account(account_s):
 | 
				
			||||||
    assert not data.Account.is_account(account_s)
 | 
					    assert not data.Account.is_account(account_s)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@pytest.mark.parametrize('account_s,expected', [
 | 
					@pytest.mark.parametrize('account_s,expected', [
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,10 +40,11 @@ FY_MID_DATE = datetime.date(2020, 9, 1)
 | 
				
			||||||
PAST_DATE = datetime.date(2000, 1, 1)
 | 
					PAST_DATE = datetime.date(2000, 1, 1)
 | 
				
			||||||
TESTS_DIR = Path(__file__).parent
 | 
					TESTS_DIR = Path(__file__).parent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This function is primarily used as a fixture, but different test files use
 | 
					# This function is a teardown fixture, but different test files use
 | 
				
			||||||
# it with different scopes. Typical usage looks like:
 | 
					# it with different scopes. Typical usage looks like:
 | 
				
			||||||
#   clean_account_meta = pytest.fixture([options])(testutil.clean_account_meta)
 | 
					#   clean_account_meta = pytest.fixture([options])(testutil.clean_account_meta)
 | 
				
			||||||
def clean_account_meta():
 | 
					def clean_account_meta():
 | 
				
			||||||
 | 
					    yield
 | 
				
			||||||
    data.Account.load_options_map(bc_options.OPTIONS_DEFAULTS)
 | 
					    data.Account.load_options_map(bc_options.OPTIONS_DEFAULTS)
 | 
				
			||||||
    data.Account._meta_map.clear()
 | 
					    data.Account._meta_map.clear()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue