Is fs basically like a tempdir scoped to each test function?
              
              #815
            
            
              
                
                  
                  
                    Answered
                  
                  by
                    mrbean-bremen
                  
              
          
                  
                    
                      jamesbraza
                    
                  
                
                  asked this question in
                Q&A
              
            -
| 
         The following code runs: import pytest
def test_a(fs):
    with open("hi.txt", mode="w"):
        pass
def test_b(fs):
    with pytest.raises(FileNotFoundError, match="hi.txt"):
        with open("hi.txt"):
            passSo just to confirm, can one think of each  Why I am asking is because if the answer is yes, I think I don't need   | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            mrbean-bremen
          
      
      
        Apr 18, 2023 
      
    
    Replies: 1 comment 1 reply
-
| 
         Yes, this is exactly what it is. There are module and session-scoped variants (  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    1 reply
                  
                
            
      Answer selected by
        jamesbraza
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Yes, this is exactly what it is. There are module and session-scoped variants (
fs_moduleandfs_session), but the standardfsfixture basically creates a new empty (except for the temp dir) in-memory filesystem at each test start.