Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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')
Пример #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')
Пример #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