-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding some error handling abilities
- Loading branch information
Showing
7 changed files
with
79 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
@task | ||
def setup(): | ||
createVenvs() | ||
createVenv() | ||
updatePackages() | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from pie import * | ||
|
||
|
||
@task | ||
def cmd_no_failure(): | ||
cmd('python -c "print(\'alpha\')"') | ||
|
||
|
||
@task | ||
def cmd_failure_non_existent(): | ||
cmd('non_existent') | ||
cmd('python -c "print(\'beta\')"') | ||
|
||
|
||
@task | ||
def cmd_failure_error_code(): | ||
cmd('python -c "import sys; sys.exit(3)"') | ||
cmd('python -c "print(\'gamma\')"') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize('pie_tasks_path',['error_handling'],indirect=['pie_tasks_path']) | ||
def test_cmd_no_failure(pie,capfd,pie_tasks_path): | ||
pie.main(['cmd_no_failure']) | ||
out,err=capfd.readouterr() | ||
out=out.replace(os.linesep,'\n') | ||
assert out=='alpha\n' | ||
|
||
@pytest.mark.parametrize('pie_tasks_path',['error_handling'],indirect=['pie_tasks_path']) | ||
def test_cmd_failure_non_existent(pie,capfd,pie_tasks_path): | ||
errorcode=pie.main(['cmd_failure_non_existent']) | ||
out,err=capfd.readouterr() | ||
assert not out.endswith('beta\n') | ||
assert errorcode==1 | ||
|
||
@pytest.mark.parametrize('pie_tasks_path',['error_handling'],indirect=['pie_tasks_path']) | ||
def test_cmd_failure_error_code(pie,capfd,pie_tasks_path): | ||
errorcode=pie.main(['cmd_failure_error_code']) | ||
out,err=capfd.readouterr() | ||
assert not out.endswith('gamma\n') | ||
assert errorcode==3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters