Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19395
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <skippy.hammond@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'thread,': 0.04; 'framework.': 0.07; 'raised': 0.07; 'threads,': 0.07; 'framework,': 0.09; "hasn't": 0.13; 'cc:addr:python-list': 0.15; '"test"': 0.16; 'assertion': 0.16; 'callback': 0.16; 'captured': 0.16; 'caveat': 0.16; 'from:name:mark hammond': 0.16; 'reply- to:addr:mhammond': 0.16; 'reply-to:addr:skippinet.com.au': 0.16; 'runner': 0.16; 'senses': 0.16; 'subject:unittest': 0.16; 'wrote:': 0.16; 'interesting.': 0.18; 'yet.': 0.18; 'seems': 0.19; 'cc:no real name:2**0': 0.21; "doesn't": 0.22; 'assume': 0.22; 'header:In-Reply-To:1': 0.22; 'received:209.85.213.46': 0.23; 'received:mail-yw0-f46.google.com': 0.23; 'ignore': 0.24; 'suspect': 0.24; 'cc:2**0': 0.25; 'code': 0.25; 'exercise': 0.25; 'tests': 0.25; 'guess': 0.25; 'seconds': 0.25; 'pm,': 0.26; 'work,': 0.26; 'expect': 0.26; 'testing': 0.26; 'code,': 0.27; 'concern': 0.28; 'bit': 0.28; 'fine.': 0.28; 'cc:addr:python.org': 0.29; 'concern,': 0.30; 'locks': 0.30; 'robust': 0.30; 'threads': 0.30; 'threads.': 0.30; 'framework': 0.30; 'does': 0.32; 'that,': 0.32; 'tue,': 0.32; 'message-id:@gmail.com': 0.33; 'header:User- Agent:1': 0.33; 'there': 0.33; 'latter': 0.34; 'running': 0.35; "i'll": 0.35; 'question': 0.35; 'test': 0.35; 'uses': 0.36; 'executing': 0.36; 'thread': 0.36; 'skip:" 10': 0.36; 'two': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'some': 0.38; 'received:209.85': 0.38; 'several': 0.38; 'think': 0.38; 'received:192': 0.38; 'correctly': 0.38; 'returned': 0.38; "i'd": 0.39; 'being': 0.39; 'sense': 0.39; 'received:209': 0.39; 'subject:: ': 0.39; 'might': 0.40; 'under': 0.40; 'worth': 0.61; 'hope': 0.61; 'happen': 0.61; 'your': 0.61; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'coordination': 0.84; 'minimum,': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=J31PwmyUDz/k4JJJ2CQgI7gdvO4/rYYpIen23eyOnKA=; b=tP8itGQBiTOH576T3kZ9iDIxqCKLdsdpSmZ8cRZ43iejJBs33cF9SDnVF3HFtTnt3d SLGMfrs4f4fBBup6Dmg36OmffeVLgEwd604+Reiw3PF69y03922NqBup/tFKvLlmFX0i nck8mtshiKaDVdane5xfH8eQWzVU+SftU/d6Q= |
| Date | Wed, 25 Jan 2012 22:24:48 +1100 |
| From | Mark Hammond <skippy.hammond@gmail.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0a2) Gecko/20120124 Thunderbird/11.0a2 |
| MIME-Version | 1.0 |
| To | Ross Boylan <ross@biostat.ucsf.edu> |
| Subject | Re: unittest and threading |
| References | <1327442063.32114.44.camel@corn.betterworld.us> <1327480968.32114.74.camel@corn.betterworld.us> |
| In-Reply-To | <1327480968.32114.74.camel@corn.betterworld.us> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | mhammond@skippinet.com.au |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5069.1327490700.27778.python-list@python.org> (permalink) |
| Lines | 49 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1327490700 news.xs4all.nl 6861 [2001:888:2000:d::a6]:42907 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:19395 |
Show key headers only | View raw
Let me have a guess :) On 25/01/2012 7:42 PM, Ross Boylan wrote: > On Tue, 2012-01-24 at 13:54 -0800, Ross Boylan wrote: ... > The code I want to test uses threads, but that is not entirely internal > from the standpoint of the unit test framework. The unit test will be > executing in one thread, but some of the assertions may occur in other > threads. The question is whether that will work, in particular whether > assertion failures will be properly captured and logged by the test > framework. I think it will - so long as your "test" on the main thread hasn't returned yet. > Concretely, a test may exercise some code that triggers a callback; the > callback might come in a different thread, and the code that is > triggered might make various assertions. > > There are two issues: whether assertions and their failures that happen > in other threads will be correctly received by the test framework, and > whether the framework is robust against several assertions being raised > "simultaneously" in different threads. The latter seems a bit much to > hope for. I suspect both will be fine. > > I assume that, at a minimum, the my test code will need to use locks or > other coordination mechanisms so the test doesn't end before all code > under test executes. Yep - that's the only caveat I'd expect . > Finally, I'll mention two senses of threads in tests that my question > does not concern, although they are also interesting. > > I am not concerned with testing the performance of my code, in the sense > of asserting that an operation must complete before x seconds or after > y seconds. Some potential implementations of such tests might use > threads even if the code under test was single-threaded. > > The question also does not concern running lots of unit tests in > parallel. nose is still worth having a look at - personally I just use it as a runner and where possible ignore its api... Mark
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: unittest and threading Mark Hammond <skippy.hammond@gmail.com> - 2012-01-25 22:24 +1100
csiph-web