Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
1d4f4a0d
Unverified
Commit
1d4f4a0d
authored
Feb 27, 2022
by
Branch Vincent
Committed by
GitHub
Feb 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(run): improve error when command not found (#5243)
parent
ea6e189a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletions
+16
-1
src/poetry/console/commands/run.py
+5
-1
tests/console/commands/test_run.py
+11
-0
No files found.
src/poetry/console/commands/run.py
View file @
1d4f4a0d
...
@@ -29,7 +29,11 @@ class RunCommand(EnvCommand):
...
@@ -29,7 +29,11 @@ class RunCommand(EnvCommand):
if
scripts
and
script
in
scripts
:
if
scripts
and
script
in
scripts
:
return
self
.
run_script
(
scripts
[
script
],
args
)
return
self
.
run_script
(
scripts
[
script
],
args
)
return
self
.
env
.
execute
(
*
args
)
try
:
return
self
.
env
.
execute
(
*
args
)
except
FileNotFoundError
:
self
.
line_error
(
f
"<error>Command not found: <c1>{script}</c1></error>"
)
return
1
@property
@property
def
_module
(
self
)
->
"Module"
:
def
_module
(
self
)
->
"Module"
:
...
...
tests/console/commands/test_run.py
View file @
1d4f4a0d
...
@@ -37,3 +37,14 @@ def test_run_keeps_options_passed_before_command(
...
@@ -37,3 +37,14 @@ def test_run_keeps_options_passed_before_command(
app_tester
.
application
.
long_version
+
"
\n
"
app_tester
.
application
.
long_version
+
"
\n
"
)
)
assert
[]
==
env
.
executed
assert
[]
==
env
.
executed
def
test_run_has_helpful_error_when_command_not_found
(
app_tester
:
"ApplicationTester"
,
env
:
"MockEnv"
):
env
.
_execute
=
True
app_tester
.
execute
(
"run nonexistent-command"
)
assert
env
.
executed
==
[[
"nonexistent-command"
]]
assert
app_tester
.
status_code
==
1
assert
app_tester
.
io
.
fetch_error
()
==
"Command not found: nonexistent-command
\n
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment