Commits

holger krekel committed 2bedb02

fix issue92 envsitepackagesdir to work correctly. Also fix the test.

Comments (0)

Files changed (6)

 1.5.0.dev
 -----------------
 
+- fix issue92 - fix {envsitepackagesdir} to actually work again
+
 - re-license tox to MIT license
 
 - depend on virtualenv-1.9.1 
         description='virtualenv-based automation of test activities',
         long_description=long_description,
         url='http://tox.testrun.org/',
-        version='1.5.0.dev1',
+        version='1.5.dev6',
         license='http://opensource.org/licenses/MIT',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
         author='holger krekel',

tests/test_z_cmdline.py

     sdist_path = session.sdist()
     assert sdist_path == p
 
-@pytest.mark.xfailif("sys.platform == 'win32'")
+@pytest.mark.xfail("sys.platform == 'win32'", reason="test needs better impl")
 def test_envsitepackagesdir(cmd, initproj):
     initproj("pkg512-0.0.5", filedefs={
         'tox.ini': """
+        [testenv]
         commands=
-            grep '__version__.*=.*0\.0\.5' {envsitepackagesdir}/pkg512/__init__.py
+            echo X:{envsitepackagesdir}
     """})
     result = cmd.run("tox")
-
+    assert result.ret == 0
+    result.stdout.fnmatch_lines("""
+        X:*site-packages*
+    """)
 #
-__version__ = '1.5.0.dev1'
+__version__ = '1.5.dev6'
 
 class exception:
     class Error(Exception):
             name = "python"
         return self.envbindir.join(name)
 
+    # no @property to avoid early calling (see callable(subst[key]) checks)
     def envsitepackagesdir(self):
         print_envsitepackagesdir = textwrap.dedent("""
         import sys
 
             raise tox.exception.ConfigError(
                 "substitution key %r not found" % key)
-        if py.builtin.callable(val):
+        elif py.builtin.callable(val):
             val = val()
         return str(val)
 
         if sub_key not in self._subs:
             raise tox.exception.ConfigError(
                 "substitution key %r not found" % sub_key)
-        return '"%s"' % str(self._subs[sub_key]).replace('"', r'\"')
+        val = self._subs[sub_key]
+        if py.builtin.callable(val):
+            val = val()
+        return '"%s"' % str(val).replace('"', r'\"')
 
     def _is_bare_posargs(self, groupdict):
         return groupdict.get('substitution_value', None) == 'posargs' \
 
 """
 
-__version__ = '1.4.3.dev6'
+__version__ = '1.5.0.dev2'
 
 import sys
 import os