diff --git a/flit/upload.py b/flit/upload.py index 15a7334a..162a18c4 100644 --- a/flit/upload.py +++ b/flit/upload.py @@ -254,7 +254,7 @@ def do_upload(file:Path, metadata:Metadata, pypirc_path="~/.pypirc", repo_name=N log.info("Package is at %s/%s", repo['url'], metadata.name) -def main(ini_path, repo_name, pypirc_path, formats=None, gen_setup_py=True): +def main(ini_path, repo_name, pypirc_path=None, formats=None, gen_setup_py=True): """Build and upload wheel and sdist.""" if pypirc_path is None: pypirc_path = PYPIRC_DEFAULT diff --git a/tests/test_upload.py b/tests/test_upload.py index 740602df..cef98795 100644 --- a/tests/test_upload.py +++ b/tests/test_upload.py @@ -155,3 +155,16 @@ def test_upload_invalid_pypirc_file(copy_sample): repo_name="test123", pypirc_path="./file.invalid", ) + +def test_upload_default_pypirc_file(copy_sample): + with patch("flit.upload.do_upload") as do_upload: + td = copy_sample("module1_toml") + formats = list(ALL_FORMATS)[:1] + upload.main( + td / "pyproject.toml", + formats=set(formats), + repo_name="test123", + ) + + file = do_upload.call_args[0][2] + assert file == "~/.pypirc"