Chris Jerdonek added the comment:

> The tempfile-generated directory names are part of the report method output 
> and are not known in advance.

There are at least two ways you could deal with this.  You could change the 
working directory to the temp directory in setUp() and change it back in 
tearDown().  This is a common pattern in the tests, and there is even a 
temp_cwd() context manager in Lib/test/support.py that will do this for you 
automatically (which unfortunately you can't use as is until issue 15351 is 
addressed).  This way the report output would be relative to the temp 
directory, and so you wouldn't need to know the absolute path.  To me this 
approach is preferred because the report output is more readable (no long file 
paths, etc).

Alternatively, you could save the temp directory path as an attribute of the 
test class, and then include it in your string match prior to calling the 
assert method.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15518>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to