New issue 292: Files created with tempfile.NamedTemporaryFile() are not
automatically removed when running under test.py
https://bitbucket.org/hpk42/pytest/issue/292/files-created-with
Nikolaus Rath:
When using tempfile.NamedTemporaryFile() while running under py.test, the
automatic deletion of the file is somehow prevented.
Testcase:
```
#!sh
$ cat test.py
from __future__ import division, print_function, absolute_import
import tempfile
import unittest2 as unittest
class cache_tests(unittest.TestCase):
def setUp(self):
self.dbfile = tempfile.NamedTemporaryFile(prefix='s3qldb_')
def test_get(self):
self.assertEqual('foo', 'foo')
$ ls /tmp/s3qldb*
/bin/ls: cannot access /tmp/s3qldb*: No such file or directory
$ py.test test.py
============ test session starts ============
platform linux2 -- Python 2.7.3 -- pytest-2.2.4
collected 1 items
test.py .
============ 1 passed in 0.01 seconds ============
$ ls /tmp/s3qldb*
/tmp/s3qldb_ZKhwhz
```
--
This is an issue notification from bitbucket.org. You are receiving
this either because you are the owner of the issue, or you are
following the issue.
_______________________________________________
pytest-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pytest-commit