Fix clearing EnvironmentModifications with python2 (#10791)
* Fix clearing EnvironmentModifications with python2 * Add EnvironmentModifications::clear unit test Use re-assignment rather than del to clear array * Fix flake issues
This commit is contained in:
		
				
					committed by
					
						
						Adam J. Stewart
					
				
			
			
				
	
			
			
			
						parent
						
							da28b592fc
						
					
				
				
					commit
					6bda37f542
				
			@@ -306,3 +306,10 @@ def test_preserve_environment(prepare_environment_for_tests):
 | 
			
		||||
    assert 'NOT_SET' not in os.environ
 | 
			
		||||
    assert os.environ['UNSET_ME'] == 'foo'
 | 
			
		||||
    assert os.environ['PATH_LIST'] == '/path/second:/path/third'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_clear(env):
 | 
			
		||||
    env.set('A', 'dummy value')
 | 
			
		||||
    assert len(env) > 0
 | 
			
		||||
    env.clear()
 | 
			
		||||
    assert len(env) == 0
 | 
			
		||||
 
 | 
			
		||||
@@ -353,7 +353,7 @@ def clear(self):
 | 
			
		||||
        """
 | 
			
		||||
        Clears the current list of modifications
 | 
			
		||||
        """
 | 
			
		||||
        self.env_modifications.clear()
 | 
			
		||||
        self.env_modifications = []
 | 
			
		||||
 | 
			
		||||
    def apply_modifications(self):
 | 
			
		||||
        """Applies the modifications and clears the list."""
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user