forked from pybuilder/pybuilder
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add finalizer actions and stable action order pybuilder#169
Add unit and integration tests fixes pybuilder#169, connected to pybuilder#169
- Loading branch information
Showing
9 changed files
with
643 additions
and
26 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
src/integrationtest/python/should_execute_teardown_on_before_failure_tests.py
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,51 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of PyBuilder | ||
# | ||
# Copyright 2011-2015 PyBuilder Team | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import unittest | ||
|
||
from integrationtest_support import IntegrationTestSupport | ||
|
||
__author__ = 'arcivanov' | ||
|
||
|
||
class Test(IntegrationTestSupport): | ||
def test(self): | ||
self.write_build_file(""" | ||
from pybuilder.core import task, before, after | ||
@task | ||
def foo(): pass | ||
@before("foo") | ||
def before_foo(): | ||
raise ValueError("simulated before failure") | ||
@after(["foo"], teardown=True) | ||
def teardown_foo(project): | ||
project.set_property("teardown_foo completed", True) | ||
""") | ||
reactor = self.prepare_reactor() | ||
project = reactor.project | ||
|
||
self.assertRaises(ValueError, reactor.build, "foo") | ||
self.assertTrue(project.get_property("teardown_foo completed")) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
48 changes: 48 additions & 0 deletions
48
src/integrationtest/python/should_execute_teardown_on_task_failure_tests.py
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,48 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of PyBuilder | ||
# | ||
# Copyright 2011-2015 PyBuilder Team | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import unittest | ||
|
||
from integrationtest_support import IntegrationTestSupport | ||
|
||
__author__ = 'arcivanov' | ||
|
||
|
||
class Test(IntegrationTestSupport): | ||
def test(self): | ||
self.write_build_file(""" | ||
from pybuilder.core import task, before, after | ||
@task | ||
def foo(): | ||
raise ValueError("simulated task failure") | ||
@after(["foo"], teardown=True) | ||
def teardown_foo(project): | ||
project.set_property("teardown_foo completed", True) | ||
""") | ||
reactor = self.prepare_reactor() | ||
project = reactor.project | ||
|
||
self.assertRaises(ValueError, reactor.build, "foo") | ||
self.assertTrue(project.get_property("teardown_foo completed")) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
52 changes: 52 additions & 0 deletions
52
src/integrationtest/python/should_skip_non_teardown_on_task_failure_tests.py
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,52 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of PyBuilder | ||
# | ||
# Copyright 2011-2015 PyBuilder Team | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import unittest | ||
|
||
from integrationtest_support import IntegrationTestSupport | ||
|
||
__author__ = 'arcivanov' | ||
|
||
|
||
class Test(IntegrationTestSupport): | ||
def test(self): | ||
self.write_build_file(""" | ||
from pybuilder.core import task, before, after | ||
@task | ||
def foo(): | ||
raise ValueError("simulated task failure") | ||
@after(["foo"]) | ||
def non_teardown_foo(project): | ||
project.set_property("non_teardown_foo ran", True) | ||
@after(["foo"], teardown=True) | ||
def teardown_foo(project): | ||
project.set_property("teardown_foo completed", True) | ||
""") | ||
reactor = self.prepare_reactor() | ||
project = reactor.project | ||
|
||
self.assertRaises(ValueError, reactor.build, "foo") | ||
self.assertIsNone(project.get_property("non_teardown_foo ran")) | ||
self.assertTrue(project.get_property("teardown_foo completed")) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
51 changes: 51 additions & 0 deletions
51
src/integrationtest/python/should_suppress_error_during_teardown_tests.py
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,51 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of PyBuilder | ||
# | ||
# Copyright 2011-2015 PyBuilder Team | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import unittest | ||
|
||
from integrationtest_support import IntegrationTestSupport | ||
|
||
__author__ = 'arcivanov' | ||
|
||
|
||
class Test(IntegrationTestSupport): | ||
def test(self): | ||
self.write_build_file(""" | ||
from pybuilder.core import task, before, after | ||
@task | ||
def foo(): | ||
raise ValueError("simulated task failure") | ||
@after(["foo"], teardown=True) | ||
def teardown1_foo(project): | ||
raise ArithmeticError("simulated teardown error") | ||
@after(["foo"], teardown=True) | ||
def teardown2_foo(project): | ||
project.set_property("teardown2_foo completed", True) | ||
""") | ||
reactor = self.prepare_reactor() | ||
project = reactor.project | ||
|
||
self.assertRaises(ValueError, reactor.build, "foo") | ||
self.assertTrue(project.get_property("teardown2_foo completed")) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
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
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
Oops, something went wrong.