Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exit with callable return code in generated script #4456

Merged
merged 1 commit into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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