Esempio n. 1
0
def test_get_argv_options_integration(context):
    u"Nose should parse sys.argv and figure out whether to run as integration"
    sys.argv = ['./manage.py', 'test', '--integration']
    runner = Nose()

    opts = runner.get_argv_options()
    assert that(opts['is_unit']).equals(False)
    assert that(opts['is_functional']).equals(False)
    assert that(opts['is_integration']).equals(True)
Esempio n. 2
0
def test_get_argv_options_simple(context):
    u"Nose should parse sys.argv"
    sys.argv = ['./manage.py', 'test']
    runner = Nose()

    opts = runner.get_argv_options()
    assert that(opts['is_unit']).equals(False)
    assert that(opts['is_functional']).equals(False)
    assert that(opts['is_integration']).equals(False)
Esempio n. 3
0
def test_get_argv_options_integration(context):
    u"Nose should parse sys.argv and figure out whether to run as integration"
    sys.argv = ['./manage.py', 'test', '--integration']
    runner = Nose()

    opts = runner.get_argv_options()
    assert that(opts['is_unit']).equals(False)
    assert that(opts['is_functional']).equals(False)
    assert that(opts['is_integration']).equals(True)
Esempio n. 4
0
def test_get_argv_options_simple(context):
    u"Nose should parse sys.argv"
    sys.argv = ['./manage.py', 'test']
    runner = Nose()

    opts = runner.get_argv_options()
    assert that(opts['is_unit']).equals(False)
    assert that(opts['is_functional']).equals(False)
    assert that(opts['is_integration']).equals(False)
Esempio n. 5
0
def test_should_try_loading_test_cmd_class(context,
                                           load_command_class,
                                           get_commands):
    u"Nose should try loading the 'test' command class"
    sys.argv = ['./manage.py', 'test',
                '--unit', '--functional', '--integration']
    runner = Nose()

    command_mock = mock.Mock()
    get_commands.return_value = {'test': 'string to load'}
    load_command_class.return_value = command_mock
    command_mock.option_list = []

    opts = runner.get_argv_options()
    assert that(opts['is_unit']).equals(True)
    assert that(opts['is_functional']).equals(True)
    assert that(opts['is_integration']).equals(True)

    get_commands.assert_called_once_with()
    load_command_class.assert_called_once_with('django.core', 'test')
Esempio n. 6
0
def test_should_try_loading_test_cmd_class(context, load_command_class,
                                           get_commands):
    u"Nose should try loading the 'test' command class"
    sys.argv = [
        './manage.py', 'test', '--unit', '--functional', '--integration'
    ]
    runner = Nose()

    command_mock = mock.Mock()
    get_commands.return_value = {'test': 'string to load'}
    load_command_class.return_value = command_mock
    command_mock.option_list = []

    opts = runner.get_argv_options()
    assert that(opts['is_unit']).equals(True)
    assert that(opts['is_functional']).equals(True)
    assert that(opts['is_integration']).equals(True)

    get_commands.assert_called_once_with()
    load_command_class.assert_called_once_with('django.core', 'test')
Esempio n. 7
0
def prepare_stuff(context, *args, **kw):
    context.runner = Nose()
    context.old_settings = get_settings(settings)
    context.options = {
        'is_unit': False,
        'is_functional': False,
        'is_integration': False,
    }
    context.old_argv = sys.argv[:]
    sys.stdout = StringIO()
    sys.stderr = StringIO()
    context.runner.get_argv_options = lambda: context.options