
import os
from django.core.management import call_command


if __name__ == '__main__':
    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'

    import django
    if hasattr(django, 'setup'):
        django.setup()

    call_command('test', nomigrations=True)


import os
from django.core.management import execute_from_command_line


if __name__ == '__main__':
    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'

    execute_from_command_line(['manage.py', 'test', '--nomigrations'])

Use a higher level command line api
Use a higher level command line api
  
  import os
- from django.core.management import call_command
+ from django.core.management import execute_from_command_line
  
  
  if __name__ == '__main__':
      os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
  
+     execute_from_command_line(['manage.py', 'test', '--nomigrations'])
-     import django
-     if hasattr(django, 'setup'):
-         django.setup()
  
-     call_command('test', nomigrations=True)
- 
Use a higher level command line api
## Code Before:

import os
from django.core.management import call_command


if __name__ == '__main__':
    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'

    import django
    if hasattr(django, 'setup'):
        django.setup()

    call_command('test', nomigrations=True)

## Instruction:
Use a higher level command line api
## Code After:

import os
from django.core.management import execute_from_command_line


if __name__ == '__main__':
    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'

    execute_from_command_line(['manage.py', 'test', '--nomigrations'])
