This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author chris.jerdonek
Recipients cbc, chris.jerdonek
Date 2012-08-01.04:30:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1343795414.04.0.380737218992.issue15518@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2012-08-01 04:30:14chris.jerdoneksetrecipients: + chris.jerdonek, cbc
2012-08-01 04:30:14chris.jerdoneksetmessageid: <1343795414.04.0.380737218992.issue15518@psf.upfronthosting.co.za>
2012-08-01 04:30:13chris.jerdoneklinkissue15518 messages
2012-08-01 04:30:11chris.jerdonekcreate