Brian van den Broek [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi all,
I'm just starting to employ unit testing (I'm using doctest), and I am
uncertain how to handle writing tests where the behaviour being tested is
dependant on whether certain file paths point to actual files.
On Mon, 04 Apr 2005 17:02:20 -0400, Brian van den Broek wrote:
Jeremy suggested using a directory name akin to
C:\onlyanidiotwouldhavethisdirecotrynameonadrive. That is what I had
settled on before I posted. Somehow it feels unhappy and inelegant.
But, I'm a bit less uncomfortable with it
Jeremy Bowers said unto the world upon 2005-04-04 17:26:
On Mon, 04 Apr 2005 17:02:20 -0400, Brian van den Broek wrote:
Jeremy suggested using a directory name akin to
C:\onlyanidiotwouldhavethisdirecotrynameonadrive. That is what I had
settled on before I posted. Somehow it feels unhappy and
Hi all,
I'm just starting to employ unit testing (I'm using doctest), and I am
uncertain how to handle writing tests where the behaviour being tested
is dependant on whether certain file paths point to actual files.
I have a class which takes, in its __init__, a list of file paths to
process.
* Brian van den Broek wrote:
The relevant part of the validation method code looks like:
# self.universe_files is a list of file paths
non_existent_files = [ x for x in self.universe_files if
not os.path.isfile(x) ]
if
Can't you use the tempfile module to generate unique names for
non-existent files and directories? Take a look at
http://www.python.org/doc/lib/module-tempfile.html -- it works on all
supported platforms.
Grig
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 02 Apr 2005 15:30:13 -0500, Brian van den Broek wrote:
So, how does one handle such cases with tests?
When I had a similar situation, I created a directory for testing that was
in a known state, and tested on that. If you can test based on a relative
directory, that should work OK.
Brian van den Broek [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi all,
I'm just starting to employ unit testing (I'm using doctest), and I am
uncertain how to handle writing tests where the behaviour being tested is
dependant on whether certain file paths point to actual