When I run django tests through manage.py test is there a way to output the result to a text file?
            Asked
            
        
        
            Active
            
        
            Viewed 3,999 times
        
    15
            
            
         
    
    
        Brian Tompsett - 汤莱恩
        
- 5,753
- 72
- 57
- 129
 
    
    
        null
        
- 1,137
- 2
- 11
- 29
- 
                    What's wrong with `manage.py test > results.txt`? – Bjorn Mar 13 '11 at 11:44
2 Answers
19
            on linux, you can do this:
python manage.py test > stdout.txt 2> stderr.txt
to redirect the output to files.
 
    
    
        Ofri Raviv
        
- 24,375
- 3
- 55
- 55
3
            
            
        Linux only...
python manage.py test 2>&1 | tee -a test.txt
This captures the stdout and stderr results as a single stream and still sends the output to the console.
Also see In the shell, what does " 2>&1 " mean? for the output redirection explanation
And How do I write stderr to a file while using "tee" with a pipe? for a slightly different output redirection method
 
    
    
        Nomen Nescio
        
- 347
- 1
- 7