<s> from django . core . management . base import BaseCommand <EOL> from django . utils import autoreload <EOL> import os <EOL> import sys <EOL> import time <EOL> INPROGRESS_FILE = '<STR_LIT>' <EOL> def get_test_command ( ) : <EOL> """<STR_LIT>""" <EOL> from test_extensions . management . commands . test import Command as TestCommand <EOL> return TestCommand ( ) <EOL> def my_reloader_thread ( ) : <EOL> """<STR_LIT>""" <EOL> while autoreload . RUN_RELOADER : <EOL> if autoreload . code_changed ( ) : <EOL> while os . path . exists ( INPROGRESS_FILE ) : <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> sys . exit ( <NUM_LIT:3> ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> autoreload . reloader_thread = my_reloader_thread <EOL> class Command ( BaseCommand ) : <EOL> option_list = BaseCommand . option_list <EOL> help = "<STR_LIT>" <EOL> args = '<STR_LIT>' <EOL> requires_model_validation = False <EOL> def handle ( self , * args , ** options ) : <EOL> if os . path . exists ( INPROGRESS_FILE ) : <EOL> os . remove ( INPROGRESS_FILE ) <EOL> def inner_run ( ) : <EOL> try : <EOL> open ( INPROGRESS_FILE , '<STR_LIT:wb>' ) . close ( ) <EOL> test_command = get_test_command ( ) <EOL> test_command . handle ( * args , ** options ) <EOL> finally : <EOL> if os . path . exists ( INPROGRESS_FILE ) : <EOL> os . remove ( INPROGRESS_FILE ) <EOL> autoreload . main ( inner_run ) </s>
