Skip to content

Commit

Permalink
editable: exit script with callable return
Browse files Browse the repository at this point in the history
This change ensures that generated scripts for editable package 
installs exit using return value from callable used.
  • Loading branch information
jouve authored Oct 8, 2021
1 parent 0d7b16f commit 14b27b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion poetry/masonry/builders/editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@

SCRIPT_TEMPLATE = """\
#!{python}
import sys
from {module} import {callable_holder}
if __name__ == '__main__':
{callable_}()
sys.exit({callable_}())
"""

WINDOWS_CMD_TEMPLATE = """\
Expand Down
9 changes: 6 additions & 3 deletions tests/masonry/builders/test_editable_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ def test_builder_installs_proper_files_for_standard_packages(simple_poetry, tmp_

baz_script = """\
#!{python}
import sys
from bar import baz
if __name__ == '__main__':
baz.boom.bim()
sys.exit(baz.boom.bim())
""".format(
python=tmp_venv.python
)
Expand All @@ -160,10 +161,11 @@ def test_builder_installs_proper_files_for_standard_packages(simple_poetry, tmp_

foo_script = """\
#!{python}
import sys
from foo import bar
if __name__ == '__main__':
bar()
sys.exit(bar())
""".format(
python=tmp_venv.python
)
Expand All @@ -172,10 +174,11 @@ def test_builder_installs_proper_files_for_standard_packages(simple_poetry, tmp_

fox_script = """\
#!{python}
import sys
from fuz.foo import bar
if __name__ == '__main__':
bar.baz()
sys.exit(bar.baz())
""".format(
python=tmp_venv.python
)
Expand Down

0 comments on commit 14b27b5

Please sign in to comment.