Permission denied in Python 3.2 env

Issue #78 on hold
Wojciech Daniło created an issue

Hi! When running tox with following tox.ini:

envlist = py32

changedir = tests
deps =
  py.test \

and a simple test file:

import logging

def test_simple(self):
    assert 1 == 1

I get error: in <module>
>   import logging
/usr/lib64/python3.2/logging/ in <module>
>       import threading
../.tox/py32/lib/python3.2/site-packages/_pytest/assertion/ in find_module
>               _make_rewritten_pyc(state, fn_pypath, pyc, co)
../.tox/py32/lib/python3.2/site-packages/_pytest/assertion/ in _make_rewritten_pyc
>           if _write_pyc(co, fn, proc_pyc):
../.tox/py32/lib/python3.2/site-packages/_pytest/assertion/ in _write_pyc
>           fp = open(pyc, "wb")
E           IOError: [Errno 13] Permission denied: '/usr/lib64/python3.2/__pycache__/threading.cpython-32-PYTEST.pyc.29938'

In python 2.7 everything works

Comments (19)

  1. Holger Krekel repo owner

    does it work on py33? I guess we need to ignore a broader range of exceptions when trying to cache the pyc file.

  2. Wojciech Daniło reporter

    I do not know if it works with py33, yes I was using custom python_files=*.py. Additional I tested everything without tox - with only py.test in hand made virtualenv and the error is the same - so it could be connected with virtualenv and tox indirectly.

  3. Holger Krekel repo owner

    I am pretty sure that without a python_files setting it should work. In any case, pytest needs to ignore write-errors here, or, better, not try to rewrite things outside of the tree below a pytest.ini.

  4. Wojciech Daniło reporter

    You are right, without custom python_files it works! (I'm sorry for my probably misleading answer befor - I'll fixed it). So yes, it is connected with py.test :)

  5. Wojciech Daniło reporter

    Maybe this is not related to this issue, but you've told about caching pyc files before and I think I've got another problem with it. I'm writing tests to a library, which when imported overrides sys.modules[its name] with a class instance (I know it is not beautifull, but such design gives me something very speciall). When running it with py.test it works every single time after a change (when pyc file is beeing created), but after it is created I get exception suggesting that the import statement results not the class I was replacing. Can you give me a hint about this issue?

  6. Wojciech Daniło reporter

    Yes, but it is not very informative. I'm trying to investigate it right now: in <module>
    >   import pluginmate
    ../pluginmate/ in <module>
    >   from .pluginmate import PluginMate
    E   AttributeError: 'tuple' object has no attribute 'pluginmate'
  7. Wojciech Daniło reporter

    Of course, but its working so far :) I would be very thankful for any help with the second issue :)

  8. Wojciech Daniło reporter

    excuse me, I've run wrong tests by mistake - I forgot to enable "import logging".

    After removing the .tox directory and invoking tox again it settles new pyenv and installs all dependencies (with pytest - so it should install the new one). And again I got the same error. Once again - I'm sorry for my mistake.

  9. Log in to comment