def test_auto_include_tests_for_sdist(): builder = Builder(FIXTURES / "projects/demo-package-with-tests") with utils.cd(builder.location): sdist_files = builder.find_files_to_add(True) wheel_files = builder.find_files_to_add(False) sdist_only_files = ("tests/__init__.py", "LICENSE", "pyproject.toml") include_files = ("my_package/__init__.py", ) for file in include_files: path = Path(file) assert path in sdist_files assert path in wheel_files for file in sdist_only_files: path = Path(file) assert path in sdist_files assert path not in wheel_files
def test_recursive_glob_patterns_in_includes() -> None: builder = Builder(FIXTURES / "projects/demo-package-with-deep-path") with builder: sdist_files = builder.find_files_to_add(True) wheel_files = builder.find_files_to_add(False) data_files = ( "my_package/data/data_a.json", "my_package/data/data_inner/data_b.json", ) assert Path("my_package/__init__.py") in sdist_files assert Path("my_package/__init__.py") in wheel_files for file in data_files: path = Path(file) assert path in sdist_files assert path not in wheel_files
def test_merge_includes_and_excludes(monkeypatch, includes, excludes, data_a_exist, data_b_exist): builder = Builder(FIXTURES / "projects/demo-package-with-deep-path") data_a, data_b = Path("my_package/data/data_a.json"), Path( "my_package/data/data_inner/data_b.json") with builder: monkeypatch.setattr(Metadata, "source_includes", []) monkeypatch.setattr(Metadata, "includes", includes) monkeypatch.setattr(Metadata, "excludes", excludes) include_files = builder.find_files_to_add() assert (data_a in include_files) == data_a_exist assert (data_b in include_files) == data_b_exist