[Pytest-commit] Issue #326: OSError 'Not a directory' when creating env on Jython 2.7.0 (hpk42/tox)

Cosimo Lupo issues-reply at bitbucket.org
Thu Apr 14 04:54:45 EDT 2016


New issue 326: OSError 'Not a directory' when creating env on Jython 2.7.0
https://bitbucket.org/hpk42/tox/issues/326/oserror-not-a-directory-when-creating-env

Cosimo Lupo:

Hi,

I cannot use tox with Jython. I'm using the latest tox 2.3.1, and Jython 2.7.0 on OS X 10.10.5 with Java 1.7.0_79.

I tried to clone this repository and run the test suite using jython. Below is the output from test_venv.py::test_create that shows my issue.

It seems that the subprocess call to `virtualenv` command that creates the new tox environment is failing because a `listdir` call in `session._initlogpath` raises `OSError` because the `envlogdir` (where the output from the subprocess is to be logged) does not exist. If I browse the `.tox` directory in Finder, I can see there is no `{envdir}/log` subfolder. 

Thank you for your support.

Cosimo


```
(jython-venv) cosimolupo at Cosimo-MBP ~/Documents/Github/tox
$ py.test -v tests/test_venv.py::test_create
============================= test session starts ==============================
platform java1.7.0_79 -- Python 2.7.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- /Users/cosimolupo/Documents/Github/fonttools/jython-venv/bin/jython
cachedir: .cache
tox comes from: '/Users/cosimolupo/Documents/Github/tox/tox/__init__$py.class'
rootdir: /Users/cosimolupo/Documents/Github/tox, inifile: tox.ini
collected 28 items 

tests/test_venv.py::test_create FAILED

=================================== FAILURES ===================================
_________________________________ test_create __________________________________

monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x69>
mocksession = <tox._pytestplugin.MockSession instance at 0x6a>
newconfig = <function newconfig at 0x6b>

    def test_create(monkeypatch, mocksession, newconfig):
        config = newconfig([], """
            [testenv:py123]
        """)
        envconfig = config.envconfigs['py123']
        venv = VirtualEnv(envconfig, session=mocksession)
        assert venv.path == envconfig.envdir
        assert not venv.path.check()
        action = mocksession.newaction(venv, "getenv")
>       tox_testenv_create(action=action, venv=venv)

tests/test_venv.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tox/venv.py:395: in tox_testenv_create
    venv._pcall(args, venv=False, action=action, cwd=basepath)
tox/venv.py:361: in _pcall
    return action.popen(args, cwd=cwd, env=env,
tox/session.py:121: in popen
    fout = self._initlogpath(self.id)
tox/session.py:107: in _initlogpath
    l = logdir.listdir("%s-*" % actionid)
tox/session.py:107: in _initlogpath
    l = logdir.listdir("%s-*" % actionid)
../fonttools/jython-venv/Lib/site-packages/py/_path/local.py:388: in listdir
    names = py.error.checked_call(os.listdir, self.strpath)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <py._error.ErrorMaker object at 0x6c>
func = <java function listdir 0x6d>
args = ('/private/var/folders/jb/rjz76yw92w7144mwqg119jnm0000gn/T/pytest-of-cosimolupo/pytest-3/test_create0/.tox/py123/log',)
kwargs = {}, __tracebackhide__ = False, cls = <class 'py.error.ENOTDIR'>
value = OSError(20, 'Not a directory'), tb = <traceback object at 0x6e>
errno = 20

    def checked_call(self, func, *args, **kwargs):
        """ call a function and raise an errno-exception if applicable. """
        __tracebackhide__ = True
        try:
            return func(*args, **kwargs)
        except self.Error:
            raise
        except (OSError, EnvironmentError):
            cls, value, tb = sys.exc_info()
            if not hasattr(value, 'errno'):
                raise
            __tracebackhide__ = False
            errno = value.errno
            try:
                if not isinstance(value, WindowsError):
                    raise NameError
            except NameError:
                # we are not on Windows, or we got a proper OSError
                cls = self._geterrnoclass(errno)
            else:
                try:
                    cls = self._geterrnoclass(_winerrnomap[errno])
                except KeyError:
                    raise value
>           raise cls("%s%r" % (func.__name__, args))
E           ENOTDIR: [Not a directory]: listdir('/private/var/folders/jb/rjz76yw92w7144mwqg119jnm0000gn/T/pytest-of-cosimolupo/pytest-3/test_create0/.tox/py123/log',)

../fonttools/jython-venv/Lib/site-packages/py/_error.py:84: ENOTDIR
=========================== 1 failed in 2.31 seconds ===========================
```


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-commit/attachments/20160414/67f5d0da/attachment.html>


More information about the pytest-commit mailing list