<s> import sys <EOL> import logging <EOL> import subprocess <EOL> sys . path . insert ( <NUM_LIT:0> , '<STR_LIT:..>' ) <EOL> from unittest2 import TestCase <EOL> class MockLoggingHandler ( logging . Handler ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> self . reset ( ) <EOL> logging . Handler . __init__ ( self , * args , ** kwargs ) <EOL> def emit ( self , record ) : <EOL> self . messages [ record . levelname . lower ( ) ] . append ( record . getMessage ( ) ) <EOL> def reset ( self ) : <EOL> self . messages = { <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT:info>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT:error>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> } <EOL> class TestNode ( TestCase ) : <EOL> def test_is_installed ( self ) : <EOL> proc = subprocess . Popen ( [ '<STR_LIT>' , '<STR_LIT>' ] , stdout = subprocess . PIPE ) <EOL> output = proc . stdout . read ( ) <EOL> self . assertEquals ( output . strip ( ) , '<STR_LIT>' ) </s>
