示例#1
0
def test_config_value_from_empty_yaml():
    with tempfile.NamedTemporaryFile() as tmp:
        tmp.write(''.encode('utf-8'))
        tmp.seek(0)
        python_path = get_config_dir(config_yaml=tmp.name)

    with open(os.path.join(python_path, CONFIG_PYTHON_FILE), 'r') as fd:
        assert str(fd.read()) == ''
示例#2
0
def test_config_value_from_empty_yaml():
    with tempfile.NamedTemporaryFile() as tmp:
        tmp.write(b"")
        tmp.seek(0)
        python_path = get_config_dir(config_yaml=tmp.name)

    with open(os.path.join(python_path, CONFIG_PYTHON_FILE), "r") as fd:
        assert str(fd.read()) == "result_backend = 'rpc://'\n"
示例#3
0
def test_config_value_from_env_yaml():
    with environ({"BROKER_URL": "pyampqp://foo@bar:1234//"}):
        with tempfile.NamedTemporaryFile() as tmp:
            tmp.write(CONFIG_YAML.encode("utf-8"))
            tmp.seek(0)
            python_path = get_config_dir(config_yaml=tmp.name)

        with open(os.path.join(python_path, CONFIG_PYTHON_FILE), "r") as fd:
            assert str(fd.read()) == CONFIG_PY
示例#4
0
def test_config_value_from_yaml():
    with instance_for_test():
        with tempfile.NamedTemporaryFile() as tmp:
            tmp.write(CONFIG_YAML.encode("utf-8"))
            tmp.seek(0)
            python_path = get_config_dir(config_yaml=tmp.name)

        with open(os.path.join(python_path, CONFIG_PYTHON_FILE), "r") as fd:
            assert str(fd.read()) == CONFIG_PY