Skip to content

Commit

Permalink
tests: fix mock failures
Browse files Browse the repository at this point in the history
`mock` would not mock `build_sdist` to return a string under
some circumstances.
  • Loading branch information
layday committed Dec 7, 2020
1 parent 3d72b5b commit 0762a9b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test_projectbuilder.py
Expand Up @@ -282,6 +282,7 @@ def test_missing_outdir(mocker, tmp_dir, test_flit_path):
mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True)

builder = build.ProjectBuilder(test_flit_path)
builder._hook.build_sdist.return_value = 'dist.tar.gz'
out = os.path.join(tmp_dir, 'out')

builder.build('sdist', out)
Expand All @@ -293,6 +294,7 @@ def test_relative_outdir(mocker, tmp_dir, test_flit_path):
mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True)

builder = build.ProjectBuilder(test_flit_path)
builder._hook.build_sdist.return_value = 'dist.tar.gz'

builder.build('sdist', '.')

Expand All @@ -303,6 +305,7 @@ def test_not_dir_outdir(mocker, tmp_dir, test_flit_path):
mocker.patch('pep517.wrappers.Pep517HookCaller', autospec=True)

builder = build.ProjectBuilder(test_flit_path)
builder._hook.build_sdist.return_value = 'dist.tar.gz'
out = os.path.join(tmp_dir, 'out')

open(out, 'a').close() # create empty file
Expand Down

0 comments on commit 0762a9b

Please sign in to comment.