Write compiled bytecodes to /dev/null, rather than write and unlink
authorZac Medico <zmedico@gentoo.org>
Tue, 17 Aug 2010 13:54:42 +0000 (06:54 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 17 Aug 2010 13:54:42 +0000 (06:54 -0700)
them.

pym/portage/tests/lint/test_compile_modules.py

index 5b86fcfb2d7bda90c69a54b9b59a5e50e1cfe316..273979b890dbd79084c2d64aeda6147fb22072b9 100644 (file)
@@ -51,13 +51,4 @@ class CompileModulesTestCase(TestCase):
                                                cfile = imp.cache_from_source(cfile)
                                        except AttributeError:
                                                cfile += (__debug__ and 'c' or 'o')
-                                       py_compile.compile(x, cfile=cfile, doraise=True)
-                                       os.unlink(cfile)
-                                       cfile_parent_dir = os.path.dirname(cfile)
-                                       if os.path.basename(cfile_parent_dir) == '__pycache__':
-                                               # Python >=3.2
-                                               try:
-                                                       os.rmdir(cfile_parent_dir)
-                                               except OSError:
-                                                       # __pycache__ directory is non-empty.
-                                                       pass
+                                       py_compile.compile(x, cfile='/dev/null', doraise=True)