python-wheel-build / fromager

Build your own wheels
https://pypi.org/project/fromager/
Apache License 2.0
3 stars 9 forks source link

`_download_source_check` raises an AttributeError if the `source_filename` doesn't end with a suffix #174

Closed shubhbapna closed 1 month ago

shubhbapna commented 1 month ago

In one of my test cases I was mocking the URL of the file being downloaded to something like this "path/foo-1.0" and got the following error:

destination_dir = PosixPath('/tmp/pytest-of-shubh/pytest-145/test_default_download_source_w0/sdists-repo/downloads'), url = 'predefined_url-1.0', rename_to = 'foo-1.0'

    def _download_source_check(
        destination_dir: pathlib.Path, url: str, rename_to: str | None = None
    ):
        source_filename = download_url(destination_dir, url, rename_to)
>       if source_filename.suffix == ".zip":
E       AttributeError: 'str' object has no attribute 'suffix'

.tox/py/lib/python3.11/site-packages/fromager/sources.py:156: AttributeError
shubhbapna commented 1 month ago

If a string is passed then it throws this error. Make sure to pass a pathlib.Path object