Skip to content

Commit

Permalink
Test default pypirc value
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrft committed Sep 19, 2021
1 parent 8fa9727 commit ecac8fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flit/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions tests/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit ecac8fb

Please sign in to comment.