import argh

from .environments import Environment
from .frameworks import Tempest
from .utils import cleanup, Reporter

LOG = Reporter(__name__).setup()


def main(endpoint, username='admin', password='secrete', test_path='api'):
    environment = Environment(username, password, endpoint)

    with cleanup(environment):
        environment.build()
        framework = Tempest(environment, repo_dir='/opt/tempest',
                            test_path=test_path)
        results = framework.run_tests()
        LOG.info('Results: {0}'.format(results))


if __name__ == '__main__':
    argh.dispatch_command(main)

import argh

from .environments import Environment
from .frameworks import Tempest
from .utils import cleanup, Reporter

LOG = Reporter(__name__).setup()


def main(endpoint, username='admin', password='secrete', test_path='api'):
    environment = Environment(username, password, endpoint)

    with cleanup(environment):
        environment.build()
        framework = Tempest(environment, repo_dir='/opt/tempest',
                            test_path=test_path)
        results = framework.run_tests()
        LOG.info('Results: {0}'.format(results))

argh.dispatch_command(main)

Move command dispatch into full module
Move command dispatch into full module

  import argh
  
  from .environments import Environment
  from .frameworks import Tempest
  from .utils import cleanup, Reporter
  
  LOG = Reporter(__name__).setup()
  
  
  def main(endpoint, username='admin', password='secrete', test_path='api'):
      environment = Environment(username, password, endpoint)
  
      with cleanup(environment):
          environment.build()
          framework = Tempest(environment, repo_dir='/opt/tempest',
                              test_path=test_path)
          results = framework.run_tests()
          LOG.info('Results: {0}'.format(results))
  
+ argh.dispatch_command(main)
  
- if __name__ == '__main__':
-     argh.dispatch_command(main)
- 
Move command dispatch into full module
## Code Before:
import argh

from .environments import Environment
from .frameworks import Tempest
from .utils import cleanup, Reporter

LOG = Reporter(__name__).setup()


def main(endpoint, username='admin', password='secrete', test_path='api'):
    environment = Environment(username, password, endpoint)

    with cleanup(environment):
        environment.build()
        framework = Tempest(environment, repo_dir='/opt/tempest',
                            test_path=test_path)
        results = framework.run_tests()
        LOG.info('Results: {0}'.format(results))


if __name__ == '__main__':
    argh.dispatch_command(main)

## Instruction:
Move command dispatch into full module
## Code After:
import argh

from .environments import Environment
from .frameworks import Tempest
from .utils import cleanup, Reporter

LOG = Reporter(__name__).setup()


def main(endpoint, username='admin', password='secrete', test_path='api'):
    environment = Environment(username, password, endpoint)

    with cleanup(environment):
        environment.build()
        framework = Tempest(environment, repo_dir='/opt/tempest',
                            test_path=test_path)
        results = framework.run_tests()
        LOG.info('Results: {0}'.format(results))

argh.dispatch_command(main)
