Created
January 3, 2013 16:57
-
-
Save anonymous/4444864 to your computer and use it in GitHub Desktop.
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
class DeprecationDisplayTest(unittest.TestCase): | |
# tests for 19546 | |
def setUp(self): | |
self.new_stderr = StringIO() | |
self.new_out = StringIO() | |
self.old_stdout = sys.stdout | |
self.old_stderr = sys.stderr | |
sys.stdout = self.new_out | |
sys.stderr = self.new_stderr | |
def tearDown(self): | |
sys.stderr = self.old_stderr | |
sys.stdout = self.old_stdout | |
print self.results | |
def test_warning_output(self): | |
# sys.stderr.write("blah blah") | |
warnings.warn("Foo deprecated", DeprecationWarning) | |
result = force_text(self.new_stderr.getvalue()) | |
resultb = force_text(self.new_stderr.getvalue()) | |
self.results = result + resultb | |
# fails | |
self.assertTrue("Foo deprecated" in result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment