How to use the nose.tools.with_setup function in nose

To help you get started, we’ve selected a few nose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github probcomp / Venturecxx / test / venturemagics / notest_ip_parallel_nose.py View on Github external
@with_setup(setup_function,teardown_function)
def testAll_IP():

    def testBuildexp():
        pass

    def testCopyFunction():
        print 'IP_COPY'
        clear_all_engines()
    # test for copy_ripl funtion
        myv = mk_ripl()
        myv.assume('x','(beta 1 1)'); myv.observe('(normal x 1)','5'); myv.predict('(flip)')
        assert [build_exp(di['expression']) for di in myv.list_directives() ] ==  [build_exp(di['expression']) for di in copy_ripl(myv).list_directives() ]
        print '...passed'

    def testParallelCopyFunction():
    # test for parallel use of copy_ripl_string
github FedericoCeratto / bottle-cork / tests / test_flask.py View on Github external
@with_setup(setup_mockedadmin, teardown_dir)
def test_password_hashing_bogus_algo_during_verify():
    # Incorrect hash type (starts with "X")
    shash = b64encode("X" + "bogusstring")
    aaa._verify_password("user_foo", "bogus_pwd", shash)
github FedericoCeratto / bottle-cork / tests / test_flask.py View on Github external
@with_setup(setup_mockedadmin, teardown_dir)
def test_perform_password_reset():
    old_dir = os.getcwd()
    os.chdir(testdir)
    token = aaa._reset_code("admin", "admin@localhost.local")
    aaa.reset_password(token, "newpassword")
    os.chdir(old_dir)
github caleb531 / youversion-suggest-alfred / tests / test_filter_prefs.py View on Github external
@nose.with_setup(set_up, tear_down)
def test_filter_refformats():
    """should filter available refformats if value is given"""
    results = yvs.get_result_list('refformat http')
    result_title = '"Jesus wept." ¬ John 11:35 NIV ¬ {url}'.format(
        url=yvs.core.get_ref_url('111/jhn.11.35'))
    result_format_id = '"{content}"\n{name} {version}\n{url}'
    nose.assert_equal(len(results), 1)
    nose.assert_equal(results[0]['uid'],
                      'yvs-refformat-{id}'.format(id=result_format_id))
    nose.assert_equal(results[0]['title'], result_title)
    nose.assert_equal(results[0].get('valid', True), True)
    nose.assert_equal(results[0]['variables'], {
        'pref_id': 'refformat',
        'pref_name': 'reference format',
        'value_id': json.dumps(result_format_id),
        'value_name': result_title
github nose-devs / nose / unit_tests / test_tools.py View on Github external
called.append('t3')

        ws1 = with_setup(s1, t1)(test)
        case1 = FunctionTestCase(ws1)
        case1(TestResult())
        self.assertEqual(called, ['s1', 'test', 't1'])

        called[:] = []
        ws2 = with_setup(s2, t2)(test2)
        ws2 = with_setup(s1, t1)(ws2)
        case2 = FunctionTestCase(ws2)
        case2(TestResult())
        self.assertEqual(called, ['s1', 's2', 'test2', 't2', 't1'])

        called[:] = []
        ws3 = with_setup(s3, t3)(test3)
        ws3 = with_setup(s2, t2)(ws3)
        ws3 = with_setup(s1, t1)(ws3)
        case3 = FunctionTestCase(ws3)
        case3(TestResult())
        self.assertEqual(called, ['s1', 's2', 's3',
                                  'test3', 't3', 't2', 't1'])
github xdress / xdress / tests / test_typesystem.py View on Github external
@with_setup(add_new_refined, del_new_refined)
def test_cython_funcname():
    cases = (
        ('joan', 'joan'),
        (('hoover',), 'hoover'),
        (('brienne', 'complex'), 'brienne_complex'),
        (('mulan', 'int', 'float'), 'mulan_int_double'),
        (('leslie', 3, True), 'leslie_3_True'),
    )
    for t, exp in cases:
        yield check_cython_funcname, t, exp  # Check that the case works,
github pyblish / pyblish-base / tests / pre11 / test_cli.py View on Github external
@with_setup(lib.setup_empty)
def test_all_commands_run():
    """All commands run without error"""

    for args in [[],            # No argument
                 ["--verbose"],
                 ["publish"],
                 ["--verbose", "publish"],
                 ]:

        runner = CliRunner()
        result = runner.invoke(pyblish.cli.main, args)

        print("Args: %s" % args)
        print("Exit code: %s" % result.exit_code)
        print("Output: %s" % result.output)
        assert result.exit_code == 0
github FedericoCeratto / bottle-cork / tests / test_flask.py View on Github external
@with_setup(setup_mockedadmin, teardown_dir)
def test_require_failing_role_fixed():
    assert_raises(AuthException, aaa.require, role="user", fixed_role=True)
github caleb531 / youversion-suggest-alfred / tests / test_filter_refs / test_chapter.py View on Github external
@nose.with_setup(set_up, tear_down)
def test_basic():
    """should match chapters"""
    results = yvs.get_result_list('matthew 5')
    nose.assert_equal(results[0]['title'], 'Matthew 5 (NIV)')
    nose.assert_equal(len(results), 1)
github leancloud / python-sdk / tests / test_user.py View on Github external
@with_setup(get_setup_func())
def test_update_password():  # type: () -> None
    user = User()
    user.login("user1_name", "password")
    user.update_password("password", "new_password")
    user.login("user1_name", "new_password")