Beispiel #1
0
def test_mp_use_db_config_path():
    assert not os.path.exists(CONFIG_PATH)

    test_props = create_local_testdb()
    dirname = os.path.dirname(test_props)
    basename = os.path.basename(test_props)

    # configure
    cmd = 'ixmp-config --db_config_path {}'.format(dirname)
    subprocess.check_call(cmd.split())

    # start jvm
    ixmp.start_jvm()

    # launch Platform and connect to testdb (reconnect if closed)
    try:
        mp = ixmp.Platform(basename)
        mp.open_db()
    except:
        os.remove(CONFIG_PATH)
        raise

    yield mp

    os.remove(CONFIG_PATH)
Beispiel #2
0
def test_mp_props():
    test_props = create_local_testdb()

    # start jvm
    ixmp.start_jvm()

    yield test_props
Beispiel #3
0
def test_mp_props():
    test_props = create_local_testdb()

    # start jvm
    ixmp.start_jvm()

    yield test_props
Beispiel #4
0
def test_mp_use_db_config_path():
    assert not os.path.exists(CONFIG_PATH)

    test_props = create_local_testdb()
    dirname = os.path.dirname(test_props)
    basename = os.path.basename(test_props)

    # configure
    cmd = 'ixmp-config --db_config_path {}'.format(dirname)
    subprocess.check_call(cmd.split())

    # start jvm
    ixmp.start_jvm()

    # launch Platform and connect to testdb (reconnect if closed)
    try:
        mp = ixmp.Platform(basename)
        mp.open_db()
    except:
        os.remove(CONFIG_PATH)
        raise

    yield mp

    os.remove(CONFIG_PATH)
def test_mp():
    # start jvm
    ixmp.start_jvm()

    # launch Platform and connect to testdb (reconnect if closed)
    mp = ixmp.Platform(tempdir(), dbtype='HSQLDB')
    mp.open_db()

    yield mp
Beispiel #6
0
def test_mp():
    test_props = create_local_testdb()

    # start jvm
    ixmp.start_jvm()

    # launch Platform and connect to testdb (reconnect if closed)
    mp = ixmp.Platform(test_props)
    mp.open_db()

    yield mp
Beispiel #7
0
def test_mp():
    test_props = create_local_testdb()

    # start jvm
    ixmp.start_jvm()

    # launch Platform and connect to testdb (reconnect if closed)
    mp = ixmp.Platform(test_props)
    mp.open_db()

    yield mp
Beispiel #8
0
def test_jvm_warn(recwarn):
    """Test that no warnings are issued on JVM start-up.

    A warning message is emitted e.g. for JPype 0.7 if the 'convertStrings'
    kwarg is not provided to jpype.startJVM.

    NB this function should be in test_core.py, but because pytest executes
    tests in file, then code order, it must be before the call to ix.Platform()
    below.
    """

    # Start the JVM for the first time in the test session
    ix.start_jvm()

    if jpype.__version__ > '0.7':
        # Zero warnings were recorded
        assert len(recwarn) == 0, recwarn.pop().message