summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorÅsmund Grammeltvedt <asmundg@big-oil.org>2013-04-06 10:17:58 +0200
committerÅsmund Grammeltvedt <asmundg@big-oil.org>2013-04-06 10:17:58 +0200
commite51f2093588d14a07b1c3e682f870d36d8ff6f2a (patch)
treeab877a171ee9e123d557dedea8a972b5fd861108 /tests
parent87b59cc3dadaf16a83ddc6c51fb0d28923de24f8 (diff)
downloadtox-git-e51f2093588d14a07b1c3e682f870d36d8ff6f2a.tar.gz
Test that envsitepackagesdir actually gets called
It's hard to check that the system integration part is correct without reimplementing it in the test, but we can at least see if the method gets called and doesn't crash.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_config.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index 9e088d4b..264710b5 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -1,6 +1,7 @@
import tox
import pytest
import os, sys
+import subprocess
from textwrap import dedent
import py
@@ -590,6 +591,35 @@ class TestConfigTestEnv:
assert conf.changedir.basename == 'testing'
assert conf.changedir.dirpath().realpath() == tmpdir.realpath()
+ @pytest.mark.xfailif("sys.platform == 'win32'")
+ def test_substitution_envsitepackagesdir(self, tmpdir, monkeypatch,
+ newconfig):
+ """
+ The envsitepackagesdir property is mostly doing system work,
+ so this test doesn't excercise it very well.
+
+ Usage of envsitepackagesdir on win32/jython will explicitly
+ throw an exception,
+ """
+ class MockPopen(object):
+ returncode = 0
+
+ def __init__(self, *args, **kwargs):
+ pass
+
+ def communicate(self, *args, **kwargs):
+ return 'onevalue', 'othervalue'
+
+ monkeypatch.setattr(subprocess, 'Popen', MockPopen)
+ env = 'py%s' % (''.join(sys.version.split('.')[0:2]))
+ config = newconfig("""
+ [testenv:%s]
+ commands = {envsitepackagesdir}
+ """ % (env))
+ conf = config.envconfigs[env]
+ argv = conf.commands
+ assert argv[0][0] == 'onevalue'
+
class TestGlobalOptions:
def test_notest(self, newconfig):