Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'classes,': 0.05; 'file)': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'missing)': 0.09; 'unittest': 0.09; '~ethan~': 0.09; 'def': 0.12; 'windows': 0.15; '@classmethod': 0.16; 'called,': 0.16; 'expecting': 0.16; 'programmatic': 0.16; 'sudo': 0.16; 'weird': 0.16; 'code.': 0.18; 'written,': 0.19; 'later': 0.20; 'import': 0.22; 'tests': 0.22; 'header:User-Agent:1': 0.23; "aren't": 0.24; 'interpret': 0.24; "i've": 0.25; 'testing': 0.29; 'raise': 0.29; "i'm": 0.30; 'getting': 0.31; "skip:' 10": 0.31; 'occurs': 0.31; 'file': 0.32; 'class': 0.32; 'summary': 0.32; "we're": 0.32; 'run': 0.32; 'running': 0.33; 'skip:s 30': 0.35; 'anybody': 0.35; 'test': 0.35; 'but': 0.35; 'method': 0.36; 'unit': 0.37; 'two': 0.37; 'being': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'expect': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'skip:p 20': 0.39; 'skip:u 10': 0.60; 'flat': 0.60; 'skip:t 30': 0.61; 'new': 0.61; 'received:173': 0.61; 'first': 0.61; 'back': 0.62; 'finally': 0.65; 'behavior': 0.77; 'exercised': 0.84; 'fails,': 0.84; 'routines': 0.84; 'killed': 0.91 Date: Tue, 11 Mar 2014 13:58:17 -0700 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Python Subject: unittest weirdness Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3304.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source-IP: 173.12.184.233 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([173.12.184.233]) [173.12.184.233]:34460 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 63 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394573211 news.xs4all.nl 2890 [2001:888:2000:d::a6]:36492 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68240 So I finally got enough data and enough of an understanding to write some unit tests for my code. These aren't the first unit tests I've written, but the behavior I'm getting is baffling. I'm using 2.7.4 and I'm testing some routines which attempt to interpret data from a flat file and create a new flat file for later programmatic consumption. The weird behavior I'm getting: - when a test fails, I get the E or F, but no summary at the end (if the failure occurs in setUpClass before my tested routines are actually called, I get the summary; if I run a test method individually I get the summary) - I have two classes, but only one is being exercised - occasionally, one of my gvim windows is unceremoniously killed (survived only by its swap file) I'm running the tests under sudo as the routines expect to be run that way. Anybody have any ideas? -- ~Ethan~ --snippet of code-- from VSS.path import Path from unittest import TestCase, main as Run import wfbrp class Test_wfbrp_20140225(TestCase): @classmethod def setUpClass(cls): cls.pp = wfbrp.PaymentProcessor( '.../lockbox_file', '.../aging_file', [ Path('month_end_1'), Path('month_end_2'), Path('month_end_3'), ], ) def test_xxx_1(self): p = self.pp.lockbox_payments[0] # affirm we have what we're expecting self.assertEqual( (p.payer, p.ck_num, p.credit), ('a customer', '010101', 10000), ) self.assertEqual(p.invoices.keys(), ['XXXXXXXXXXX']) self.assertEqual(p.invoices.values()[0].amount, 10000) # now make sure we get back what we're expecting np, b = self.pp._match_invoices(p) missing = [] for inv_num in ('123456', '789012', '345678'): if inv_num not in b: missing.append(inv_num) if missing: raise ValueError('invoices %r missing from batch' % missing)