tests: Set a default CONSERVANCY_REPOSITORY for testing.
This commit is contained in:
		
							parent
							
								
									91a436abd5
								
							
						
					
					
						commit
						d8b0a56fb4
					
				
					 2 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
					@ -6,9 +6,9 @@ from . import testutil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@pytest.fixture(scope='session', autouse=True)
 | 
					@pytest.fixture(scope='session', autouse=True)
 | 
				
			||||||
def clean_environment():
 | 
					def clean_environment():
 | 
				
			||||||
    os.environ.pop('CONSERVANCY_REPOSITORY', None)
 | 
					 | 
				
			||||||
    os.environ.pop('RTAUTH', None)
 | 
					    os.environ.pop('RTAUTH', None)
 | 
				
			||||||
    os.environ.pop('RTPASSWD', None)
 | 
					    os.environ.pop('RTPASSWD', None)
 | 
				
			||||||
    os.environ.pop('RTSERVER', None)
 | 
					    os.environ.pop('RTSERVER', None)
 | 
				
			||||||
    os.environ.pop('RTUSER', None)
 | 
					    os.environ.pop('RTUSER', None)
 | 
				
			||||||
 | 
					    os.environ['CONSERVANCY_REPOSITORY'] = str(testutil.test_path('repository'))
 | 
				
			||||||
    os.environ['HOME'] = str(testutil.test_path('userconfig'))
 | 
					    os.environ['HOME'] = str(testutil.test_path('userconfig'))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,11 +73,11 @@ def update_environ(**kwargs):
 | 
				
			||||||
    _update_environ(revert)
 | 
					    _update_environ(revert)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_repository_from_environment():
 | 
					def test_repository_from_environment():
 | 
				
			||||||
    with update_environ(CONSERVANCY_REPOSITORY='/usr/local'):
 | 
					 | 
				
			||||||
    config = config_mod.Config()
 | 
					    config = config_mod.Config()
 | 
				
			||||||
        assert config.repository_path().parts == ('/', 'usr', 'local')
 | 
					    assert config.repository_path() == testutil.test_path('repository')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_no_repository():
 | 
					def test_no_repository():
 | 
				
			||||||
 | 
					    with update_environ(CONSERVANCY_REPOSITORY=None):
 | 
				
			||||||
        config = config_mod.Config()
 | 
					        config = config_mod.Config()
 | 
				
			||||||
        assert config.repository_path() is None
 | 
					        assert config.repository_path() is None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue