Permission denied with Python3.2 #112
Description
Activity
Original comment by BitBucket: andrewcooke, GitHub: andrewcooke:
I just checked and python3.1 works fine (pycache is new in 3.2).
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):
Are you using pytest version 2.2.1? If so, could you try out the dev version with "pip install -i http://pypi.testrun.org -U pytest"? Thanks, holger
Original comment by BitBucket: andrewcooke, GitHub: andrewcooke:
thanks for replying. yes, i was using 2.2.1. using 2.2.2.dev5 gives the same errors.
Original comment by BitBucket: andrewcooke, GitHub: andrewcooke:
since this is related to the python version, here are the details:
{{{uname -a
Linux small.europa2189 3.1.0-1.2-desktop #1 SMP PREEMPT Thu Nov 3 14:45:45 UTC 2011 (187dde0) x86_64 x86_64 x86_64 GNU/Linux
python3.2
Python 3.2.2 (default, Dec 20 2011, 21:47:22)
[GCC 4.6.2] on linux2
}}}Original comment by BitBucket: andrewcooke, GitHub: andrewcooke:
the files being debugged (or very similar ones) are at http://code.google.com/p/lepl/source/browse/ so, for example, the file /home/andrew/projects/personal/lepl/lepl/src/lepl/support/lib.py which leads to threading.py (if i understand your debug logs correctly) is at http://code.google.com/p/lepl/source/browse/src/lepl/support/lib.py
Original comment by BitBucket: andrewcooke, GitHub: andrewcooke:
hi, some more information on this. i just noticed that i had a pytest.ini file (which must have been configured a long time ago, because it was excluding subversion directories and i have been using mercurial for as long as i can recall).
anyway, the problem goes away if i remove the line
{{{
python_files = *.py
}}}unfortunately, because i don't use special names for test files, it then fails to pick up most of my tests. but it also no longer gives the error i reported.
so perhaps what i should be asking is - how do i configure pytest to work with the way that i have my code organised? each package has a {{{_test}}} directory that contains the tests, typically named after the modules in the parent directory. so, for example:
{{{
src/
+- foo/
+- bar.py
+- baz.py
+- _test/
+- bar.py - contains tests for foo.bar
+- baz.py - contains tests for foo.baz
}}}the ini file i would like to use would look like this:
{{{
[pytest]
python_files = .py
python_classes = *Test
python_functions = test_
}}}which, as described above, works fine with python 3.1, but not with 3.2.
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):
first of all, the permission denied issue remains an issue, pytest should not fail if it can't write y pyc file.
second, you should be able to use the patterns you specify. i think you could look into the "norecursedirs" config file option or adding the "--ignore=" command line option via the "addopts" config file option. The latter may be problematic because there is no way to construct a sensible path in the ini-file which would be independent from where you invoke it. If you try adding via addopts and things work fine when you call it from the dir where pytest.ini resides in then we can consider (in another issue) adding better support for specifying such a path independently from CWD.
Original comment by Erik Bray (BitBucket: embray, GitHub: embray):
This is still an issue in pytest 2.3.5. I was able to work around the issue in my own code by patching
_pytest.assertion.rewrite._write_pycto catch permission errors and returnFalsein that case.(see astropy/astropy@0feb25a, specifically)
- addedtype: bugproblem that needs to be addressedproblem that needs to be addressed
on Jun 15, 2015 - added a commit that references this issue
on Oct 27, 2018 - added a commit that references this issue
on May 27, 2023
Originally reported by: BitBucket: andrewcooke, GitHub: andrewcooke
Hi,
I just tried to install and run pytest under python 3.2 and I see many errors like:
I installed again with Python 2.7 to check, and that works fine:
But the identical command with Python3.2 gives:
This is particularly frustrating since I use pytest in Intellij Idea as a test runner - it's the only hing that seems to work (everything else wants file names with certain conventions that I haven't followed etc).