summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Leverton <levertond@googlemail.com>2012-01-02 15:14:10 +0000
committerHugo Parente Lima <hugo.pl@gmail.com>2012-01-05 19:52:21 -0200
commit2ae8e750f77fe68bef2041019f3493487f8c3afc (patch)
tree05b2a3f2d4ea9805c966872ec91fd3bf8be44d12
parenta8d255e9784b47d1e1f6f797decdbc0f5306d815 (diff)
downloadpyside-2ae8e750f77fe68bef2041019f3493487f8c3afc.tar.gz
pyside-2ae8e750f77fe68bef2041019f3493487f8c3afc.tar.xz
pyside-2ae8e750f77fe68bef2041019f3493487f8c3afc.zip
Fix tests/QtGui/pyside_reload_test.py when PYTHONDONTWRITEBYTECODE=1
Trying to remove the bytecode file doesn't work if it wasn't created in the first place. This can happen for example under Gentoo, where bytecode is disabled while building packages to avoid sandbox violations when Python tries to write a bytecode file for an already-installed module outside the package build directory. Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>
-rw-r--r--tests/QtGui/pyside_reload_test.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/QtGui/pyside_reload_test.py b/tests/QtGui/pyside_reload_test.py
index 3fd593c..7fc4748 100644
--- a/tests/QtGui/pyside_reload_test.py
+++ b/tests/QtGui/pyside_reload_test.py
@@ -23,13 +23,14 @@ def increment_module_value():
modfile.write('Sentinel.value += 1' + os.linesep)
modfile.flush()
modfile.close()
- if py3k.IS_PY3K:
- import imp
- cacheFile = imp.cache_from_source(dst)
- else:
- cacheFile = dst + 'c'
- os.remove(cacheFile)
+ if not sys.dont_write_bytecode:
+ if py3k.IS_PY3K:
+ import imp
+ cacheFile = imp.cache_from_source(dst)
+ else:
+ cacheFile = dst + 'c'
+ os.remove(cacheFile)
class TestModuleReloading(unittest.TestCase):