[issue24932] Migrate _testembed to a C unit testing library

2016-12-30 Thread Steve Dower
Steve Dower added the comment: The only real advantage of adding a native unit testing framework here is to avoid having to start/destroy _testembed[.exe] multiple times during the test run. But given the nature of these tests is highly environmental, I don't think we can reasonably avoid

Help: Python unit testing

2016-07-05 Thread Harsh Gupta
Hello All, I have been trying to write a test framework for a pretty simple command server application in python. I have not been able to figure out how to test the socket server. I would really appreciate if you could help me out in testing this application using unittest. I'm new to this.

[issue24932] Migrate _testembed to a C unit testing library

2015-08-25 Thread Brett Cannon
Brett Cannon added the comment: Someone is going to think of [googletest] (https://github.com/google/googletest) and then realize that it is a C++ test suite and thus won't work unless you explicitly compile Python for C++. -- nosy: +brett.cannon

[issue24932] Migrate _testembed to a C unit testing library

2015-08-24 Thread Nick Coghlan
to change the interpreter startup sequence and make it more configurable, it seems desirable to be better able to test more configuration options directly, without relying on the abstraction layer provided by the main CPython executable. The specific unit testing library that prompted this idea

Score one for unit testing.

2014-01-02 Thread Roy Smith
is that while looking at the code to figure out why this was failing, I noticed a completely unrelated bug in the production code. See, unit testing helps find bugs :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Score one for unit testing.

2014-01-02 Thread Chris Angelico
On Fri, Jan 3, 2014 at 9:53 AM, Roy Smith r...@panix.com wrote: We've got a test that's been running fine ever since it was written a month or so ago. Now, it's failing intermittently on our CI (continuous integration) box, so I took a look. I recommend you solve these problems the way these

Unit testing asynchronous processes

2013-12-10 Thread Tim Chase
I've got some code that kicks off a background request to a remote server over an SSL connection using client-side certificates. Since the request is made from a separate thread, I'm having trouble testing that everything is working without without spinning up an out-of-band mock server and

Re: Unit testing asynchronous processes

2013-12-10 Thread Terry Reedy
On 12/10/2013 9:24 PM, Tim Chase wrote: I've got some code that kicks off a background request to a remote server over an SSL connection using client-side certificates. Since the request is made from a separate thread, I'm having trouble testing that everything is working without without

Re: unit testing class hierarchies

2012-10-04 Thread Terry Reedy
On 10/3/2012 5:33 AM, Oscar Benjamin wrote: On 3 October 2012 02:20, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: But surely, regardless of where that functionality is defined, you still need to test that both D1 and D2 exhibit the correct behaviour? Otherwise D2 (say) may break

Re: unit testing class hierarchies

2012-10-03 Thread Oscar Benjamin
On 3 October 2012 02:20, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: But surely, regardless of where that functionality is defined, you still need to test that both D1 and D2 exhibit the correct behaviour? Otherwise D2 (say) may break that functionality and your tests won't

unit testing class hierarchies

2012-10-02 Thread Ulrich Eckhardt
Greetings! I'm trying to unittest a class hierachy using Python 2.7. I have a common baseclass Base and derived classes D1 and D2 that I want to test. The baseclass in not instantiatable on its own. Now, the first approach is to have test cases TestD1 and TestD2, both derived from class

Re: unit testing class hierarchies

2012-10-02 Thread Demian Brecht
[1] in C++ I would call that a mixin Mixins are perfectly valid Python constructs as well and are perfectly valid (imho) for this use case. On a side note, I usually append a Mixin suffix to my mixin classes in order to make it obvious to the reader. -- Demian Brecht @demianbrecht

Re: unit testing class hierarchies

2012-10-02 Thread Thomas Bach
On Tue, Oct 02, 2012 at 02:27:11PM +0200, Ulrich Eckhardt wrote: As you see, the code for test_base() is redundant, so the idea is to move it to a baseclass: class TestBase(unittest.TestCase): def test_base(self): ... class TestD1(TestBase): def test_r(self):

Re: unit testing class hierarchies

2012-10-02 Thread Peter Otten
Ulrich Eckhardt wrote: As you see, the code for test_base() is redundant, so the idea is to move it to a baseclass: class TestBase(unittest.TestCase): def test_base(self): ... class TestD1(TestBase): def test_r(self): ... def test_s(self):

Re: unit testing class hierarchies

2012-10-02 Thread Fayaz Yusuf Khan
Peter Otten wrote: Ulrich Eckhardt wrote: The problem here is that TestBase is not a complete test case (just as class Base is not complete), but the unittest framework will still try to run it on its own. How exactly are you invoking the test runner? unittest? nose? You can tell the test

Re: unit testing class hierarchies

2012-10-02 Thread Ulrich Eckhardt
Am 02.10.2012 16:06, schrieb Thomas Bach: On Tue, Oct 02, 2012 at 02:27:11PM +0200, Ulrich Eckhardt wrote: As you see, the code for test_base() is redundant, so the idea is to move it to a baseclass: class TestBase(unittest.TestCase): def test_base(self): ... class

Re: unit testing class hierarchies

2012-10-02 Thread Ulrich Eckhardt
Am 02.10.2012 16:06, schrieb Thomas Bach: On Tue, Oct 02, 2012 at 02:27:11PM +0200, Ulrich Eckhardt wrote: As you see, the code for test_base() is redundant, so the idea is to move it to a baseclass: class TestBase(unittest.TestCase): def test_base(self): ... class

Re: unit testing class hierarchies

2012-10-02 Thread Peter Otten
Ulrich Eckhardt wrote: Am 02.10.2012 16:06, schrieb Thomas Bach: On Tue, Oct 02, 2012 at 02:27:11PM +0200, Ulrich Eckhardt wrote: As you see, the code for test_base() is redundant, so the idea is to move it to a baseclass: class TestBase(unittest.TestCase): def test_base(self):

Re: unit testing class hierarchies

2012-10-02 Thread Peter Otten
Fayaz Yusuf Khan wrote: Peter Otten wrote: Ulrich Eckhardt wrote: The problem here is that TestBase is not a complete test case (just as class Base is not complete), but the unittest framework will still try to run it on its own. How exactly are you invoking the test runner? unittest?

Re: unit testing class hierarchies

2012-10-02 Thread Demian Brecht
Am I missing something? Is there something that wasn't answered by my reply about using mixins? from unittest import TestCase class SharedTestMixin(object): def test_shared(self): self.assertNotEquals('foo', 'bar') class TestA(TestCase, SharedTestMixin): def test_a(self):

Re: unit testing class hierarchies

2012-10-02 Thread Demian Brecht
Am I missing something? Is there something that wasn't answered by my reply about using mixins? from unittest import TestCase class SharedTestMixin(object): def test_shared(self): self.assertNotEquals('foo', 'bar') class TestA(TestCase, SharedTestMixin): def test_a(self):

Re: unit testing class hierarchies

2012-10-02 Thread Mark Lawrence
On 02/10/2012 19:06, Demian Brecht wrote: Am I missing something? Is there something that wasn't answered by my reply about using mixins? from unittest import TestCase class SharedTestMixin(object): def test_shared(self): self.assertNotEquals('foo', 'bar') class TestA(TestCase,

Re: unit testing class hierarchies

2012-10-02 Thread Ben Finney
Ulrich Eckhardt ulrich.eckha...@dominolaser.com writes: I want test_base() to be run as part of both TestD1 and TestD2, because it tests basic functions provided by both classes D1 and D2. It sounds, from your description so far, that you have identified a design flaw in D1 and D2. The common

Re: unit testing class hierarchies

2012-10-02 Thread Roy Smith
In article mailman.1734.1349199947.27098.python-l...@python.org, Peter Otten __pete...@web.de wrote: Another is to remove it from the global namespace with del TestBase When I had this problem, that's the solution I used. -- http://mail.python.org/mailman/listinfo/python-list

Re: unit testing class hierarchies

2012-10-02 Thread Steven D'Aprano
On Wed, 03 Oct 2012 08:30:19 +1000, Ben Finney wrote: Ulrich Eckhardt ulrich.eckha...@dominolaser.com writes: I want test_base() to be run as part of both TestD1 and TestD2, because it tests basic functions provided by both classes D1 and D2. It sounds, from your description so far, that

Re: unit-profiling, similar to unit-testing

2011-11-17 Thread Ulrich Eckhardt
of this is similar to unit testing (code to set up/tear down), but other things are too different. Also, sometimes I can vary tests with a factor F, then I would also want to capture the influence of this factor. I would even wonder if you can't verify the behaviour agains an expected Big-O complexity

Re: unit-profiling, similar to unit-testing

2011-11-17 Thread Roy Smith
In article kkuep8-nqd@satorlaser.homedns.org, Ulrich Eckhardt ulrich.eckha...@dominolaser.com wrote: Yes, this is surely something that is necessary, in particular since there are no clear success/failure outputs like for unit tests and they require a human to interpret them. As much

Re: unit-profiling, similar to unit-testing

2011-11-17 Thread Tycho Andersen
. Are there tools available that help? I was considering using the unit testing framework, but the problem with that is that the results are too hard to interpret programmatically and too easy to misinterpret manually. Any suggestions? It's really, really, really hard to either control

Re: unit-profiling, similar to unit-testing

2011-11-17 Thread spartan.the
On Nov 17, 4:03 pm, Roy Smith r...@panix.com wrote: In article kkuep8-nqd@satorlaser.homedns.org,  Ulrich Eckhardt ulrich.eckha...@dominolaser.com wrote: Yes, this is surely something that is necessary, in particular since there are no clear success/failure outputs like for unit tests

Re: unit-profiling, similar to unit-testing

2011-11-17 Thread Roy Smith
In article mailman.2810.1321562763.27778.python-l...@python.org, Tycho Andersen ty...@tycho.ws wrote: While I agree there's a lot of things you can't control for, you can get a more accurate picture by using CPU time instead of wall time (e.g. the clock() system call). If what you care about

unit-profiling, similar to unit-testing

2011-11-16 Thread Ulrich Eckhardt
, network load, day of the week (Tuesday is virus scan day) etc. What I'd just like to ask is how you do such things. Are there tools available that help? I was considering using the unit testing framework, but the problem with that is that the results are too hard to interpret programmatically

Re: unit-profiling, similar to unit-testing

2011-11-16 Thread Roy Smith
the unit testing framework, but the problem with that is that the results are too hard to interpret programmatically and too easy to misinterpret manually. Any suggestions? It's really, really, really hard to either control for, or accurately measure, things like CPU or network load. There's so

Unit testing beginner question

2011-05-23 Thread Andrius
Hello, would be gratefull for the explonation. I did a simple test case: def setUp(self): self.testListNone = None def testListSlicing(self): self.assertRaises(TypeError, self.testListNone[:1]) and I am expecting test to pass, but I am getting exception: Traceback (most recent call last):

Re: Unit testing beginner question

2011-05-23 Thread Andrius A
That was quick! Thanks Ian On 23 May 2011 23:46, Ian Kelly ian.g.ke...@gmail.com wrote: On Mon, May 23, 2011 at 4:30 PM, Andrius andriu...@gmail.com wrote: and I am expecting test to pass, but I am getting exception: Traceback (most recent call last): self.assertRaises(TypeError,

Re: Unit testing beginner question

2011-05-23 Thread Ian Kelly
On Mon, May 23, 2011 at 4:30 PM, Andrius andriu...@gmail.com wrote: and I am expecting test to pass, but I am getting exception: Traceback (most recent call last):    self.assertRaises(TypeError, self.testListNone[:1]) TypeError: 'NoneType' object is unsubscriptable I thought that

Re: Unit testing beginner question

2011-05-23 Thread Roy Smith
In article mailman.1991.1306191316.9059.python-l...@python.org, Ian Kelly ian.g.ke...@gmail.com wrote: This would work: self.assertRaises(TypeError, lambda: self.testListNone[:1]) If you're using the version of unittest from python 2.7, there's an even nicer way to write this: with

Re: Unit testing multiprocessing code on Windows

2011-02-18 Thread Matt Chaput
On 18/02/2011 2:54 AM, Terry Reedy wrote: On 2/17/2011 6:31 PM, Matt Chaput wrote: Does anyone know the right way to write a unit test for code that uses multiprocessing on Windows? I would start with Lib/test/test_multiprocessing. Good idea, but on the one hand it doesn't seem to be doing

Re: Unit testing multiprocessing code on Windows

2011-02-18 Thread Matt Chaput
On 17/02/2011 8:22 PM, phi...@semanchuk.com wrote: Hi Matt, I assume you're aware of this documentation, especially the item entitled Safe importing of main module? http://docs.python.org/release/2.6.6/library/multiprocessing.html#windows Yes, but the thing is my code isn't __main__, my

Re: Unit testing multiprocessing code on Windows

2011-02-18 Thread David
Il Thu, 17 Feb 2011 18:31:59 -0500, Matt Chaput ha scritto: The problem is that with both python setup.py tests and nosetests, Maybe multiprocessing is starting new Windows processes by copying the command line of the current process? But if the command line is nosetests, it's a one way

Unit testing multiprocessing code on Windows

2011-02-17 Thread Matt Chaput
Does anyone know the right way to write a unit test for code that uses multiprocessing on Windows? The problem is that with both python setup.py tests and nosetests, when they get to testing any code that starts Processes they spawn multiple copies of the testing suite (i.e. the new processes

Unit testing multiprocessing code on Windows

2011-02-17 Thread Matt Chaput
Does anyone know the right way to write a unit test for code that uses multiprocessing on Windows? The problem is that with both python setup.py tests and nosetests, when they get to a multiprocessing test they spawn multiple copies of the testing suite. The test runner in PyDev works

Re: Unit testing multiprocessing code on Windows

2011-02-17 Thread philip
Quoting Matt Chaput m...@whoosh.ca: Does anyone know the right way to write a unit test for code that uses multiprocessing on Windows? The problem is that with both python setup.py tests and nosetests, when they get to testing any code that starts Processes they spawn multiple copies of

Re: Unit testing multiprocessing code on Windows

2011-02-17 Thread Terry Reedy
On 2/17/2011 6:31 PM, Matt Chaput wrote: Does anyone know the right way to write a unit test for code that uses multiprocessing on Windows? I would start with Lib/test/test_multiprocessing. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Attest 0.4 released: Modern, Pythonic unit testing

2011-01-09 Thread dag.odenh...@gmail.com
Hello fellow Pythonista, I just released version 0.4 of Attest, a modern framework for unit testing. Website and documentation: http://packages.python.org/Attest/ Source code: https://github.com/dag/attest Issues: https://github.com/dag/attest/issues PyPI: http://pypi.python.org/pypi/Attest/0.4

Strategies for unit testing an HTTP server.

2010-11-29 Thread Alice Bevan–McGregor
Hello! Two things are missing from the web server I've been developing before I can release 1.0: unit tests and documentation. Documentation being entirely my problem, I've run into a bit of a snag with unit testing; just how would you go about it? Specifically, I need to test things like

Re: Unit testing errors (testing the platform module)

2010-04-14 Thread Gabriel Genellina
En Tue, 13 Apr 2010 11:01:19 -0300, John Maclean jaye...@gmail.com escribió: Is there an error in my syntax? Why is my test failing? Line 16. == FAIL: platform.__builtins__.blah

unit testing, setUp and scoping

2010-04-14 Thread john maclean
Can one use the setUp block to store variables so that they can be used elsewhere in unit tests? I'm thinking that it's better to have variables created in another script and have it imported from within the unit test #!/usr/bin/env python '''create knowledge base of strings by unit testing

Re: Unit testing errors (testing the platform module)

2010-04-14 Thread john maclean
On 14 April 2010 09:09, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Tue, 13 Apr 2010 11:01:19 -0300, John Maclean jaye...@gmail.com escribió: Is there an error in my syntax? Why is my test failing? Line 16. == FAIL:

Re: unit testing, setUp and scoping

2010-04-14 Thread Bruno Desthuilliers
of strings by unit testing''' import unittest class TestPythonStringsTestCase(unittest.TestCase): def setUp(self): print '''setting up stuff for ''', __name__ s1 = 'single string' print dir(str) def testclass(self

Re: Unit testing errors (testing the platform module)

2010-04-14 Thread J. Cliff Dyer
On Wed, 2010-04-14 at 15:51 +0100, john maclean wrote: self.assertEqual(platform.__builtins__.__class__, dict, platform.__class__ supposed to be dict) self.assertEqual(platform.__name__, 'platform' ) The preferred spelling for: platform.__builtins__.__class__ would be

Re: unit testing, setUp and scoping

2010-04-14 Thread Francisco Souza
On Wed, Apr 14, 2010 at 11:47 AM, john maclean jaye...@gmail.com wrote: Can one use the setUp block to store variables so that they can be used elsewhere in unit tests? I'm thinking that it's better to have variables created in another script and have it imported from within the unit test

Re: unit testing, setUp and scoping

2010-04-14 Thread john maclean
On 14 April 2010 16:22, Francisco Souza franci...@franciscosouza.net wrote: On Wed, Apr 14, 2010 at 11:47 AM, john maclean jaye...@gmail.com wrote: Can one use the setUp block to store variables so that they can be used elsewhere in unit tests? I'm thinking that it's better to have variables

Re: Unit testing errors (testing the platform module)

2010-04-14 Thread Terry Reedy
On 4/14/2010 11:19 AM, J. Cliff Dyer wrote: On Wed, 2010-04-14 at 15:51 +0100, john maclean wrote: self.assertEqual(platform.__builtins__.__class__, dict, platform.__class__ supposed to be dict) self.assertEqual(platform.__name__, 'platform' ) The preferred spelling for:

Unit testing errors (testing the platform module)

2010-04-13 Thread John Maclean
I normally use languages unit testing framework to get a better understanding of how a language works. Right now I want to grok the platform module; 1 #!/usr/bin/env python 2 '''a pythonic factor''' 3 import unittest 4 import platform 5 6 class TestPyfactorTestCase(unittest.TestCase

Re: Unit testing errors (testing the platform module)

2010-04-13 Thread Benjamin Kaplan
On Tue, Apr 13, 2010 at 10:01 AM, John Maclean jaye...@gmail.com wrote: I normally use languages unit testing framework to get a better understanding of how a language works. Right now I want to grok the platform module; 1 #!/usr/bin/env python 2 '''a pythonic factor''' 3 import

Re: Unit testing errors (testing the platform module)

2010-04-13 Thread Martin P. Hellwig
On 04/13/10 15:01, John Maclean wrote: I normally use languages unit testing framework to get a better understanding of how a language works. Right now I want to grok the platform module; 1 #!/usr/bin/env python 2 '''a pythonic factor''' 3 import unittest 4 import platform 5

Re: Unit testing errors (testing the platform module)

2010-04-13 Thread MRAB
John Maclean wrote: I normally use languages unit testing framework to get a better understanding of how a language works. Right now I want to grok the platform module; 1 #!/usr/bin/env python 2 '''a pythonic factor''' 3 import unittest 4 import platform 5 6 class

Re: Unit testing errors (testing the platform module)

2010-04-13 Thread J. Cliff Dyer
languages unit testing framework to get a better understanding of how a language works. Right now I want to grok the platform module; 1 #!/usr/bin/env python 2 '''a pythonic factor''' 3 import unittest 4 import platform 5 6 class TestPyfactorTestCase(unittest.TestCase): 7

Re: unit testing a routine that sends mail

2010-02-19 Thread Bruno Desthuilliers
commander_coder a écrit : Hello, I have a routine that sends an email (this is how a Django view notifies me that an event has happened). I want to unit test that routine. http://docs.djangoproject.com/en/dev/topics/email/#e-mail-backends Or if you're stuck with 1.x 1.2a, you could just

unit testing a routine that sends mail

2010-02-18 Thread commander_coder
Hello, I have a routine that sends an email (this is how a Django view notifies me that an event has happened). I want to unit test that routine. So I gave each mail a unique subject line and I want to use python's mailbox package to look for that subject. But sometimes the mail gets delivered

Re: unit testing a routine that sends mail

2010-02-18 Thread commander_coder
On Feb 18, 9:55 am, Roy Smith r...@panix.com wrote: Just a wild guess here, but maybe there's some DNS server which round-robins three address records for some hostname you're using, one of which is bogus. I've seen that before, and this smells like the right symptoms. Everything happens on

Re: unit testing a routine that sends mail

2010-02-18 Thread commander_coder
On Feb 18, 10:27 am, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: you could just mock the send_mail function to test that your app does send the appropriate mail - which is what you really want to know. That's essentially what I think I am doing. I need to send a

Re: unit testing a routine that sends mail

2010-02-18 Thread commander_coder
Bruno, I talked to someone who explained to me how what you said gives a way around my difficulty. Please ignore the other reply. I'll do what you said. Thank you; I appreciate your help. Jim -- http://mail.python.org/mailman/listinfo/python-list

Re: unit testing a routine that sends mail

2010-02-18 Thread Phlip
commander_coder wrote: I have a routine that sends an email (this is how a Django view notifies me that an event has happened).  I want to unit test that routine. Are you opening SMTP and POP3 sockets?? If you are not developing that layer itself, just use Django's built- in mock system.

Re: Replacing module with a stub for unit testing

2009-05-29 Thread s4g
Try import sys import ExpensiveModuleStub sys.modules['ExpensiveModule'] = ExpensiveModuleStub sys.modules['ExpensiveModule'].__name__ = 'ExpensiveModule' Should do the trick -- Vyacheslav -- http://mail.python.org/mailman/listinfo/python-list

Re: Replacing module with a stub for unit testing

2009-05-24 Thread A. Cavallo
how about the old and simple: import ExpensiveModuleStub as ExpensiveModule On a different league you could make use of decorator and creating caching objects but that depends entirely on the requirements (how strict your test must be, test data sizes involved and more, much more details).

Re: Replacing module with a stub for unit testing

2009-05-24 Thread Steven D'Aprano
On Sun, 24 May 2009 13:14:30 +0100, A. Cavallo wrote: how about the old and simple: import ExpensiveModuleStub as ExpensiveModule No, that won't do, because for it to have the desired effort, it needs to be inside the IntermediateModule, not the Test_Module. That means that

Replacing module with a stub for unit testing

2009-05-23 Thread pigmartian
Hi, I'm working on a unit test framework for a module. The module I'm testing indirectly calls another module which is expensive to access --- CDLLs whose functions access a database. test_MyModule ---MyModule---IntermediateModule--- ExpensiveModule I want to create a stub of

Re: Replacing module with a stub for unit testing

2009-05-23 Thread Steven D'Aprano
On Sat, 23 May 2009 06:00:15 -0700, pigmartian wrote: Hi, I'm working on a unit test framework for a module. The module I'm testing indirectly calls another module which is expensive to access --- CDLLs whose functions access a database. ... The examples I can find of creating and using

Re: Replacing module with a stub for unit testing

2009-05-23 Thread Ben Finney
pigmart...@gmail.com writes: import ExpensiveModuleStub sys.modules['ExpensiveModule'] = ExpensiveModuleStub # Doesn't work But, import statements in the IntermediateModule still access the real ExpensiveModule, not the stub. The examples I can find of creating and using Mock

Re: Unit testing frameworks

2009-03-30 Thread Alexander Draeger
Hi, I'm work on a testing framework for Python. Until now I have implemented the main features of PyUnit and JUnit 4.x. I like the annotation syntax of JUnit 4.x and it's theory concept is great therefore you can imagine how my framework will be. I plan a lot of additionally features which are

Re: Unit testing frameworks

2009-03-25 Thread Fabio Zadrozny
Hi Andew, not exactly a framework, but useful while working on small projects - you can run tests from inside eclipse (using the pydev plugin for python). it's easy to run all tests or some small subset (although it is a bit buggy for 3.0). What exactly is not working with 3.0? (couldn't

Re: Unit testing frameworks

2009-03-25 Thread andrew cooke
Fabio Zadrozny wrote: not exactly a framework, but useful while working on small projects - you can run tests from inside eclipse (using the pydev plugin for python). it's easy to run all tests or some small subset (although it is a bit buggy for 3.0). What exactly is not working with 3.0?

Re: Unit testing frameworks

2009-03-25 Thread andrew cooke
copy+paste error; the correct Python2.6 details are: Python 2.6 (r26:66714, Feb 3 2009, 20:49:49) andrew cooke wrote: this is with a homebuilt 3.0 - Python 3.0 (r30:67503, Jan 16 2009, 06:50:19) and opensuse's default 2.6 - Python 3.0 (r30:67503, Jan 16 2009, 06:50:19) - on Eclipse 3.3.2

Re: Unit testing frameworks

2009-03-25 Thread grkuntzmd
In unittest, has anyone used the *NIX command find to automatically build a test suite file of all tests under a specified directory? I generally name my tests as _Test_ORIGINAL_MODULE_NAME.py where ORIGINAL_MODULE_NAME is the obvious value. This way, I can include/ exclude them from deployments,

Re: Unit testing frameworks

2009-03-25 Thread Fabio Zadrozny
sorry for not reporting a bug - i assumed you'd know (and the workarounds described above meant i wasn't stalled). i also have eclipse 3.4.2 with pydev 1.4.4.2636 on a separate machine (ie new versions), and i can try there if you want (it will take a while to get the source there, but is

Unit testing frameworks

2009-03-24 Thread grkuntzmd
I am looking for a unit testing framework for Python. I am aware of nose, but was wondering if there are any others that will automatically find and run all tests under a directory hierarchy. Thanks, Ralph -- http://mail.python.org/mailman/listinfo/python-list

Re: Unit testing frameworks

2009-03-24 Thread Jean-Paul Calderone
On Tue, 24 Mar 2009 05:06:47 -0700 (PDT), grkunt...@gmail.com wrote: I am looking for a unit testing framework for Python. I am aware of nose, but was wondering if there are any others that will automatically find and run all tests under a directory hierarchy. One such tool is trial, http

Re: Unit testing frameworks

2009-03-24 Thread andrew cooke
grkunt...@gmail.com wrote: I am looking for a unit testing framework for Python. I am aware of nose, but was wondering if there are any others that will automatically find and run all tests under a directory hierarchy. not exactly a framework, but useful while working on small projects - you

Re: Unit testing frameworks

2009-03-24 Thread Maxim Khitrov
On Tue, Mar 24, 2009 at 8:06 AM, grkunt...@gmail.com wrote: I am looking for a unit testing framework for Python. I am aware of nose, but was wondering if there are any others that will automatically find and run all tests under a directory hierarchy. Have you already looked at the unittest

Re: Unit testing frameworks

2009-03-24 Thread pruebauno
On Mar 24, 8:06 am, grkunt...@gmail.com wrote: I am looking for a unit testing framework for Python. I am aware of nose, but was wondering if there are any others that will automatically find and run all tests under a directory hierarchy. Thanks, Ralph *Nose *Trial *py.test -- http

Re: Unit testing frameworks

2009-03-24 Thread Gabriel Genellina
En Tue, 24 Mar 2009 09:06:47 -0300, grkunt...@gmail.com escribió: I am looking for a unit testing framework for Python. I am aware of nose, but was wondering if there are any others that will automatically find and run all tests under a directory hierarchy. All known testing tools (and some

Re: Exhaustive Unit Testing

2008-11-30 Thread Roel Schroeven
Steven D'Aprano schreef: [..] Thank you for elaborate answer, Steven. I think I'm really starting to get it now. -- The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom. -- Isaac Asimov Roel Schroeven --

Re: Exhaustive Unit Testing

2008-11-30 Thread James Harris
On 27 Nov, 16:32, Emanuele D'Arrigo [EMAIL PROTECTED] wrote: On Nov 27, 5:00 am, Steven D'Aprano [EMAIL PROTECTED] wrote: Refactor until your code is simple enough to unit-test effectively, then unit-test effectively. Ok, I've taken this wise suggestion on board and of course I found

Re: Exhaustive Unit Testing

2008-11-29 Thread Roel Schroeven
I've never understood about unit testing, and each time I try to apply unit testing I bump up against, and don't know how to resolve. I find it also difficult to explain exactly what I mean. Suppose I need to write method spam() that turns out to be somewhat complex, like the class method

Re: Exhaustive Unit Testing

2008-11-29 Thread Steven D'Aprano
of paths. I don't understand that. This is part of something I've never understood about unit testing, and each time I try to apply unit testing I bump up against, and don't know how to resolve. I find it also difficult to explain exactly what I mean. Suppose I need to write method spam

Re: Exhaustive Unit Testing

2008-11-29 Thread Fuzzyman
On Nov 29, 3:33 am, Emanuele D'Arrigo [EMAIL PROTECTED] wrote: On Nov 29, 12:35 am, Fuzzyman [EMAIL PROTECTED] wrote: Your experiences are one of the reasons that writing the tests *first* can be so helpful. You think about the *behaviour* you want from your units and you test for that

Re: Exhaustive Unit Testing

2008-11-29 Thread Roel Schroeven
Thanks for your answer. I still don't understand completely though. I suppose it's me, but I've been trying to understand some of this for quite some and somehow I can't seem to wrap my head around it. Steven D'Aprano schreef: On Sat, 29 Nov 2008 11:36:56 +0100, Roel Schroeven wrote: The

Re: Exhaustive Unit Testing

2008-11-29 Thread Steven D'Aprano
On Sat, 29 Nov 2008 17:13:00 +0100, Roel Schroeven wrote: Except that I'm always told that the goal of unit tests, at least partly, is to protect us agains mistakes when we make changes to the tested functions. They should tell me wether I can still trust spam() after refactoring it. Doesn't

Re: Exhaustive Unit Testing

2008-11-29 Thread Steven D'Aprano
On Sun, 30 Nov 2008 03:42:50 +, Steven D'Aprano wrote: def lcm(a, b): return a/gcd(a, b)*b (By the way: there's a subtle bug in lcm() that will hit you in Python 3. Can you spot it? Er, ignore this. Division in Python 3 only returns a float if the remainder is non-zero, and when

Re: Exhaustive Unit Testing

2008-11-29 Thread Terry Reedy
Steven D'Aprano wrote: On Sun, 30 Nov 2008 03:42:50 +, Steven D'Aprano wrote: def lcm(a, b): return a/gcd(a, b)*b (By the way: there's a subtle bug in lcm() that will hit you in Python 3. Can you spot it? Er, ignore this. Division in Python 3 only returns a float if the remainder

Re: Exhaustive Unit Testing

2008-11-28 Thread bearophileHUGS
Terry Reedy: The problem is that inner functions do not exist until the outer function is called and the inner def is executed. And they cease to exist when the outer function returns unless returned or associated with a global name or collection. OK. A 'function' only needs to be nested

Re: Exhaustive Unit Testing

2008-11-28 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : (snip) Consequently, I almost always use single-underscore private by convention names, rather than double-underscore names. The name-mangling is, in my experience, just a nuisance. s/just/most often than not/ and we'll agree on this !-) --

Re: Exhaustive Unit Testing

2008-11-28 Thread Nigel Rantor
Roy Smith wrote: There's a well known theory in studies of the human brain which says people are capable of processing about 7 +/- 2 pieces of information at once. It's not about processing multiple taks, it's about the amount of things that can be held in working memory. n --

Re: Exhaustive Unit Testing

2008-11-28 Thread Roy Smith
In article [EMAIL PROTECTED], Nigel Rantor [EMAIL PROTECTED] wrote: Roy Smith wrote: There's a well known theory in studies of the human brain which says people are capable of processing about 7 +/- 2 pieces of information at once. It's not about processing multiple taks, it's

Re: Exhaustive Unit Testing

2008-11-28 Thread Steven D'Aprano
On Fri, 28 Nov 2008 00:06:01 -0800, bearophileHUGS wrote: For this to change wouldn't be a little change, it would be a large change. I see, then my proposal has little hope, I presume. I'll have to keep moving functions outside to test them and move them inside again when I want to run

Re: Exhaustive Unit Testing

2008-11-28 Thread Terry Reedy
[EMAIL PROTECTED] wrote: Terry Reedy: A 'function' only needs to be nested if it is intended to be different (different default or closure) for each execution of its def. Or maybe because you want to denote a logical nesting, or maybe because you want to keep the outer namespace cleaner,

Re: Exhaustive Unit Testing

2008-11-28 Thread Fuzzyman
On Nov 27, 4:32 pm, Emanuele D'Arrigo [EMAIL PROTECTED] wrote: On Nov 27, 5:00 am, Steven D'Aprano [EMAIL PROTECTED] wrote: Refactor until your code is simple enough to unit-test effectively, then unit-test effectively. Ok, I've taken this wise suggestion on board and of course I found

Re: Exhaustive Unit Testing

2008-11-28 Thread Emanuele D'Arrigo
Thank you to everybody who has replied about the original problem. I eventually refactored the whole (monster) method over various smaller and simpler ones and I'm now testing each individually. Things have gotten much more tractable. =) Thank you for nudging me in the right direction! =) Manu

Re: Exhaustive Unit Testing

2008-11-28 Thread Emanuele D'Arrigo
On Nov 29, 12:35 am, Fuzzyman [EMAIL PROTECTED] wrote: Your experiences are one of the reasons that writing the tests *first* can be so helpful. You think about the *behaviour* you want from your units and you test for that behaviour - *then* you write the code until the tests pass. Thank you

  1   2   3   >