def test_get_requirements_empty_pre_exist(tmp_path):
    reqs_path = tmp_path / "reqs.txt"
    reqs_path.touch()
    get_requirements.main(
        ["--addons-dir", str(tmp_path), "-o",
         str(reqs_path)])
    assert reqs_path.read_text() == ""
def test_get_requirements_header(tmp_path):
    reqs_path = tmp_path / "reqs.txt"
    get_requirements.main([
        "--addons-dir", DATA_DIR, "-o",
        str(reqs_path), "--header", "# generated"
    ])
    assert reqs_path.read_text() == "# generated\nastropy\npython-dateutil\n"
def test_get_requirements_empty_with_header(tmp_path):
    reqs_path = tmp_path / "reqs.txt"
    get_requirements.main([
        "--addons-dir",
        str(tmp_path), "-o",
        str(reqs_path), "--header", "# header"
    ])
    assert not reqs_path.exists()
def test_get_requirements_with_setup_dir(tmp_path):
    generated_dir = os.path.join(DATA_DIR, "setup")
    make_default_setup.main(["--addons-dir", DATA_DIR, "-f"])
    try:
        reqs_path = tmp_path / "reqs.txt"
        get_requirements.main(["--addons-dir", DATA_DIR, "-o", str(reqs_path)])
        assert reqs_path.read_text() == "astropy\npython-dateutil\n"
    finally:
        shutil.rmtree(generated_dir)
def test_get_requirements_include_addons(tmp_path):
    reqs_path = tmp_path / "reqs.txt"
    get_requirements.main([
        "--addons-dir",
        os.path.join(DATA_DIR, "setup_custom_project", "odoo_addons"),
        "-o",
        str(reqs_path),
        "--include-addons",
    ])
    assert reqs_path.read_text() == "odoo>=8.0a,<9.0a\npython-dateutil\n"
def test_get_requirements(tmp_path):
    reqs_path = tmp_path / "reqs.txt"
    get_requirements.main(["--addons-dir", DATA_DIR, "-o", str(reqs_path)])
    assert reqs_path.read_text() == "astropy\npython-dateutil\n"