aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-08-08 11:44:12 -0400
committerJason R. Coombs <jaraco@jaraco.com>2020-08-08 11:44:12 -0400
commit7c3a3817923de67956656ea058e80669b77bed1f (patch)
tree436649ae1e07b040ace1106f6cc9c4635cdab6a2 /setuptools/tests
parent5e60dc50e540a942aeb558aabe7d92ab7eb13d4b (diff)
downloadexternal_python_setuptools-7c3a3817923de67956656ea058e80669b77bed1f.tar.gz
external_python_setuptools-7c3a3817923de67956656ea058e80669b77bed1f.tar.bz2
external_python_setuptools-7c3a3817923de67956656ea058e80669b77bed1f.zip
Add tests capturing expected distutils behavior. Ref #417.
Diffstat (limited to 'setuptools/tests')
-rw-r--r--setuptools/tests/test_distutils_adoption.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/setuptools/tests/test_distutils_adoption.py b/setuptools/tests/test_distutils_adoption.py
new file mode 100644
index 00000000..f4c7072d
--- /dev/null
+++ b/setuptools/tests/test_distutils_adoption.py
@@ -0,0 +1,37 @@
+import os
+import pytest
+
+
+@pytest.fixture
+def env(virtualenv):
+ virtualenv.run(['pip', 'uninstall', '-y', 'setuptools'])
+ virtualenv.run(['pip', 'install', os.getcwd()])
+ return virtualenv
+
+
+def find_distutils(env, imports='distutils'):
+ py_cmd = 'import {imports}; print(distutils.__file__)'.format(**locals())
+ cmd = ['python', '-c', py_cmd]
+ return env.run(cmd, capture=True, text=True)
+
+
+def test_distutils_stdlib(env):
+ """
+ Ensure stdlib distutils is used when appropriate.
+ """
+ assert '.env' not in find_distutils(env).split(os.sep)
+
+
+def test_distutils_local_with_setuptools(env):
+ """
+ Ensure local distutils is used when appropriate.
+ """
+ env.env.update(SETUPTOOLS_USE_DISTUTILS='local')
+ loc = find_distutils(env, imports='setuptools, distutils')
+ assert '.env' in loc.split(os.sep)
+
+
+@pytest.mark.xfail(reason="#2259")
+def test_distutils_local(env):
+ env.env.update(SETUPTOOLS_USE_DISTUTILS='local')
+ assert '.env' in find_distutils(env).split(os.sep)