def test_get_history_env_and_key_filter(tmp_path):
    """Asserts combined use of filters works"""
    file_a = tmp_path / "file_a.toml"
    file_b = tmp_path / "file_b.toml"
    create_file(
        file_a,
        """\
        [default]
        foo="from_default_a"
        bar="from_default_a"
        [development]
        foo="from_development_a"
        bar="from_development_a"
        [prod]
        foo="from_prod_a"
        bar="from_prod_a"
        """,
    )
    create_file(
        file_b,
        """\
        [default]
        foo="from_default_b"
        bar="from_default_b"
        [development]
        foo="from_development_b"
        bar="from_development_b"
        [prod]
        foo="from_prod_b"
        bar="from_prod_b"
        """,
    )

    settings = Dynaconf(settings_file=[file_a, file_b], environments=True)
    settings.from_env("prod")  # CAVEAT: activate loading of prod
    history = get_history(
        settings,
        key="bar",
        filter_callable=lambda x: x.env.lower() == "prod",
    )
    assert len(history) == 2
    assert history[0]["value"] == "from_prod_a"
    assert history[1]["value"] == "from_prod_b"
Asserts combined use of filters works
tests/test_inspect.py