-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from cjwatson/layer-failure
Improve output when layer setUp or tearDown fails
- Loading branch information
Showing
7 changed files
with
173 additions
and
10 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2012-2018 Zope Foundation and Contributors. | ||
# All Rights Reserved. | ||
# | ||
# This software is subject to the provisions of the Zope Public License, | ||
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | ||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | ||
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS | ||
# FOR A PARTICULAR PURPOSE. | ||
# | ||
############################################################################## | ||
"""Sample tests with layers that have broken set up and tear down.""" | ||
|
||
import unittest | ||
|
||
|
||
class BrokenSetUpLayer: | ||
|
||
@classmethod | ||
def setUp(cls): | ||
raise ValueError('No value is good enough for me!') | ||
|
||
@classmethod | ||
def tearDown(cls): | ||
pass | ||
|
||
|
||
class BrokenTearDownLayer: | ||
|
||
@classmethod | ||
def setUp(cls): | ||
pass | ||
|
||
@classmethod | ||
def tearDown(cls): | ||
raise TypeError('You are not my type. No-one is my type!') | ||
|
||
|
||
class TestSomething1(unittest.TestCase): | ||
|
||
layer = BrokenSetUpLayer | ||
|
||
def test_something(self): | ||
pass | ||
|
||
|
||
class TestSomething2(unittest.TestCase): | ||
|
||
layer = BrokenTearDownLayer | ||
|
||
def test_something(self): | ||
pass | ||
|
||
|
||
def test_suite(): | ||
suite = unittest.TestSuite() | ||
suite.addTest(unittest.makeSuite(TestSomething1)) | ||
suite.addTest(unittest.makeSuite(TestSomething2)) | ||
return suite |
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