1. Holger Krekel
  2. tox
  3. Issues


Issue #78 on hold

Permission denied in Python 3.2 env

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:

interface.py:1: in <module>
>   import logging
/usr/lib64/python3.2/logging/__init__.py:45: in <module>
>       import threading
../.tox/py32/lib/python3.2/site-packages/_pytest/assertion/rewrite.py:141: in find_module
>               _make_rewritten_pyc(state, fn_pypath, pyc, co)
../.tox/py32/lib/python3.2/site-packages/_pytest/assertion/rewrite.py:226: in _make_rewritten_pyc
>           if _write_pyc(co, fn, proc_pyc):
../.tox/py32/lib/python3.2/site-packages/_pytest/assertion/rewrite.py:171: 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. 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.

  2. 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.

  3. 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?

  4. Wojciech Daniło reporter

    Yes, but it is not very informative. I'm trying to investigate it right now:

    test_interface.py:9: in <module>
    >   import pluginmate
    ../pluginmate/__init__.py:1: in <module>
    >   from .pluginmate import PluginMate
    E   AttributeError: 'tuple' object has no attribute 'pluginmate'
  5. 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.

  6. Log in to comment