Message118287
| Author |
vinay.sajip |
| Recipients |
ggenellina, guettli, hoffman, news1234, pakal, r.david.murray, vinay.sajip, ysj.ray |
| Date |
2010年10月09日.19:04:09 |
| SpamBayes Score |
7.657879e-05 |
| Marked as misclassified |
No |
| Message-id |
<1286651051.45.0.355648146933.issue1553375@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
David, I don't think it's that - I think it's the subprocess comms. This works:
def _do_test(self, program, exc_text):
with open(self.testfn, 'w') as testmod:
testmod.writelines(program.format(
exception_action=self.exception_action))
p = subprocess.Popen([sys.executable, 'testmod.py'],
stderr=subprocess.PIPE)
streams = p.communicate()
v1 = streams[1].decode('utf-8') # this shouldn't be hardcoded!
v2 = exc_text.format(exception_action=self.exception_action)
self.assertEqual(v1, v2)
But I don't think the 'utf-8' encoding should be hardcoded. Not sure what to use - sys.getfilesystemencoding()? locale.getpreferredencoding()?
Decisions, decisions :-( |
|