Follow-up to r1090, fix test_with_statement test on windows, where `NamedTemporaryFile` can't be used in this situation.
Closes #357.
diff --git a/genshi/template/tests/eval.py b/genshi/template/tests/eval.py
|
a
|
b
|
|
| 16 | 16 | import pickle |
| 17 | 17 | from StringIO import StringIO |
| 18 | 18 | import sys |
| 19 | | from tempfile import NamedTemporaryFile |
| | 19 | from tempfile import mkstemp |
| 20 | 20 | import unittest |
| 21 | 21 | |
| 22 | 22 | from genshi.core import Markup |
| … |
… |
|
| 787 | 787 | |
| 788 | 788 | if sys.version_info >= (2, 5): |
| 789 | 789 | def test_with_statement(self): |
| 790 | | f = NamedTemporaryFile() |
| | 790 | fd, path = mkstemp() |
| | 791 | f = os.fdopen(fd, "w") |
| 791 | 792 | f.write('foo\nbar\n') |
| 792 | 793 | f.seek(0) |
| | 794 | f.close() |
| 793 | 795 | |
| 794 | | d = {'path': f.name} |
| | 796 | d = {'path': path} |
| 795 | 797 | suite = Suite("""from __future__ import with_statement |
| 796 | 798 | lines = [] |
| 797 | 799 | with open(path) as file: |
| … |
… |
|
| 800 | 802 | """) |
| 801 | 803 | suite.execute(d) |
| 802 | 804 | self.assertEqual(['foo\n', 'bar\n'], d['lines']) |
| | 805 | os.remove(path) |
| 803 | 806 | |
| 804 | 807 | def test_yield_expression(self): |
| 805 | 808 | d = {} |