Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'explicitly': 0.04; 'context': 0.05; '__name__': 0.07; 'completeness': 0.07; 'escape': 0.07; 'stops': 0.07; 'unittest': 0.07; 'python': 0.09; 'abort': 0.09; 'received:155': 0.09; 'def': 0.10; 'itself.': 0.11; 'yet.': 0.13; 'language': 0.14; '(like': 0.15; 'result.': 0.15; "'__main__':": 0.16; 'at.': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:159.53.110': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'securities,': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.17; 'handles': 0.18; 'tests': 0.18; '>>>': 0.18; 'to:name:python- list@python.org': 0.20; 'import': 0.21; 'error.': 0.21; 'exceptions': 0.22; "haven't": 0.23; 'received:169.254': 0.24; 'second': 0.24; 'testing': 0.24; 'header:In-Reply-To:1': 0.25; 'guess': 0.27; 'separate': 0.27; 'accuracy': 0.27; 'run': 0.28; 'assert': 0.29; 'separated': 0.29; 'handled': 0.29; 'received:169': 0.29; 'probably': 0.29; 'class': 0.29; "i'm": 0.29; 'framework': 0.30; 'running': 0.32; 'getting': 0.33; 'impression': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'knowledge': 0.33; 'false': 0.35; 'so,': 0.35; 'there': 0.35; 'but': 0.36; 'method': 0.36; 'test': 0.36; 'charset:us-ascii': 0.36; 'two': 0.37; 'being': 0.37; 'listing': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'unit': 0.38; 'some': 0.38; 'sure': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'think': 0.40; 'your': 0.60; 'easy': 0.60; 'skip:u 10': 0.60; 'first': 0.61; 'is.': 0.62; 'information,': 0.63; 'url:email': 0.63; 'other.': 0.64; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'expectations': 0.71; 'sale': 0.76; 'andrea': 0.84; 'received:169.254.8': 0.84 X-DKIM: OpenDKIM Filter v2.1.3 sj1.jpmchase.com q6HL59Jg022184 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1342559109; bh=eV7ZR88yeHyI7i3AnlRkiSoDCnfSrFLwoYsPeJ8d4Es=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=WKwB4J9LAU0qRESciuS48eXCO49YxKsSZRnHo0G7aiAXGZRiy8Jy9VZwbPZM42xtk AIUn6mzEgKi5iS/nta722izQyxveRIb4QQkzvVEluN6DJfbN71ceRRFd+Wx6hFvSZM M6iAIZv5+dXUH8LtnjITJftXTOLjSaGRLZxU3Avg= From: "Prasad, Ramit" To: "python-list@python.org" Subject: RE: assertraises behaviour Thread-Topic: assertraises behaviour Thread-Index: AQHNZAe+C+9Y20973EmcJPD96WEAOZctwKJQgABHQYD//+7HQA== Date: Tue, 17 Jul 2012 21:04:57 +0000 References: <5B80DD153D7D744689F57F4FB69AF4741657AA3F@SCACMX008.exchad.jpmchase.net> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.79.47] Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-DLP-FWD: Yes Content-Type: text/plain; charset="us-ascii" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342559119 news.xs4all.nl 6980 [2001:888:2000:d::a6]:58713 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25540 > On 17/07/2012 18:49, Prasad, Ramit wrote:=0D=0A> >>> import unittest=0D= =0A> >>>=0D=0A> >>> class TestWithRaises(unittest=2ETestCase):=0D=0A> >>> = def test_first(self):=0D=0A> >>> assert False=0D=0A> >>>=0D= =0A> >>> def test_second(self):=0D=0A> >>> print("also call= ed")=0D=0A> >>> assert True=0D=0A> >>>=0D=0A> >>> if __name__ =3D= =3D '__main__':=0D=0A> >>> unittest=2Emain()=0D=0A> >>>=0D=0A> >>> in= this case also the second test is run even if the first fails=2E=2E=0D=0A>= >>=0D=0A> >> The reason for that is that the unit testing framework catche= s and=0D=0A> >> handles the error=2E It calls both test functions in some u= nspecified=0D=0A> >> order and logs the result=2E Calls to two separate tes= t functions are=0D=0A> >> thereby separated from each other=2E This is inte= ntionally so, but I think=0D=0A> >> you can also give the unit testing fram= ework a flag that makes it abort=0D=0A> >> after the first error=2E In no w= ay will the exception escape from the=0D=0A> >> unittest=2Emain() call thou= gh, it is all caught and handled inside, also=0D=0A> >> by intention=2E=0D= =0A> >>=0D=0A> >>=0D=0A> >>> But that's probably easy because we just need = to catch exceptions for=0D=0A> >>> every method call, so it's not exactly t= he same thing=2E=2E=0D=0A> >>=0D=0A> >> I don't understand what you want to= say here=2E I also don't understand=0D=0A> >> what your problem in general= is=2E I guess there are some expectations=0D=0A> >> which are not satisfie= d, but you haven't explained those explicitly yet=2E=0D=0A> >>=0D=0A> >=0D= =0A> > I think Andrea wants to do the same thing but with nose and not=0D= =0A> > unittest=2E=0D=0A> >=0D=0A> > Ramit=0D=0A> >=0D=0A> =0D=0A> Do what?= Like Ulrich Eckhart I simply don't understand what she's=0D=0A> getting a= t=2E Perhaps it's a problem with Englsh being a second language=0D=0A> iss= ue rather than Python itself=2E Thankfully I'm sure that everything=0D=0A>= will come out in the wash=2E=0D=0A> =0D=0A> --=0D=0A> Cheers=2E=0D=0A> =0D= =0A> Mark Lawrence=2E=0D=0A=0D=0A=0D=0AI get the impression that nose stops= running tests once any test =0D=0Afails instead of running all tests and l= isting all the tests and =0D=0Atheir pass/fail status (like unittest)=2E Gr= anted that is just what =0D=0AI get from the context as I read it as I have= no knowledge of nose=2E=0D=0A=0D=0ARamit=0D=0AThis email is confidential a= nd subject to important disclaimers and=0D=0Aconditions including on offers= for the purchase or sale of=0D=0Asecurities, accuracy and completeness of = information, viruses,=0D=0Aconfidentiality, legal privilege, and legal enti= ty disclaimers,=0D=0Aavailable at http://www=2Ejpmorgan=2Ecom/pages/disclos= ures/email=2E