Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Serhiy Storchaka Newsgroups: comp.lang.python Subject: Re: How to parameterize unittests Date: Fri, 15 Apr 2016 11:31:07 +0300 Lines: 11 Message-ID: References: <570FA466.20003@rece.vub.ac.be> <570fb1a3$0$1609$c3e8da3$5496439d@news.astraweb.com> <57108FAC.3020105@rece.vub.ac.be> <5710A442.8000906@rece.vub.ac.be> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 0eULlvlXe5rI4v2N0YPiKQBdee/TDCpnNhv0rBTQUQig== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'modifying': 0.07; 'rewrite': 0.07; 'tests,': 0.07; 'subject:How': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'file,': 0.15; 'instantiate': 0.16; 'paste.': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'test.': 0.18; 'tests.': 0.18; 'import': 0.24; 'patch': 0.24; 'written': 0.24; 'header:In- Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'header:X-Complaints-To:1': 0.26; 'run': 0.33; 'values.': 0.33; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'setting': 0.37; 'received:org': 0.37; 'test': 0.39; 'to:addr:python.org': 0.40; 'forget': 0.60; 'your': 0.60; 'charset:windows-1252': 0.62; 'more': 0.63; 'cut': 0.67; 'restore': 0.70; 'directly.': 0.76; 'flexible,': 0.84; 'pardon': 0.84; 'approach.': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: 193.202.118.164 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: <5710A442.8000906@rece.vub.ac.be> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <570FA466.20003@rece.vub.ac.be> <570fb1a3$0$1609$c3e8da3$5496439d@news.astraweb.com> <57108FAC.3020105@rece.vub.ac.be> <5710A442.8000906@rece.vub.ac.be> Xref: csiph.com comp.lang.python:107032 On 15.04.16 11:20, Antoon Pardon wrote: > But the tests, at this moment, are not written to instantiate self.tree > but to call avltree directly. So I have to rewrite these tests. That > will IMO involve a lot of cut and paste. There is yet one approach. Import your original test file, patch it by setting it's global avltree to your subclass, run tests. Don't forget to restore original values. This approach is more fragile and less flexible, but doesn't need modifying the original test.