Commit 95386da9 authored by Benoit Pierre's avatar Benoit Pierre

tests: rework clean install test

Use pytest-virtualenv so the test can be run no Windows too.
parent bf20d881
......@@ -43,7 +43,4 @@ install:
# update egg_info based on setup.py in checkout
- python bootstrap.py
# Check that setuptools can be installed in a clean environment
- tests/clean_install.sh
script: tox
import os
from pytest import yield_fixture
from pytest_fixture_config import yield_requires_config
import pytest_virtualenv
@yield_requires_config(pytest_virtualenv.CONFIG, ['virtualenv_executable'])
@yield_fixture(scope='function')
def bare_virtualenv():
""" Bare virtualenv (no pip/setuptools/wheel).
"""
with pytest_virtualenv.VirtualEnv(args=(
'--no-wheel',
'--no-pip',
'--no-setuptools',
)) as venv:
yield venv
SOURCE_DIR = os.path.join(os.path.dirname(__file__), '../..')
def test_clean_env_install(bare_virtualenv):
"""
Check setuptools can be installed in a clean environment.
"""
bare_virtualenv.run(' && '.join((
'cd {source}',
'python setup.py install',
)).format(source=SOURCE_DIR))
#!/usr/bin/env bash
# This test was created in
# https://github.com/pypa/setuptools/pull/1050
# but it really should be incorporated into the test suite
# such that it runs on Windows and doesn't depend on
# virtualenv. Moving to test_integration will likely address
# those concerns.
set -o errexit
set -o xtrace
# Create a temporary directory to install the virtualenv in
VENV_DIR="$(mktemp -d)"
function cleanup() {
rm -rf "$VENV_DIR"
}
trap cleanup EXIT
# Create a virtualenv that doesn't have pip or setuptools installed
wget https://raw.githubusercontent.com/pypa/virtualenv/master/virtualenv.py
python virtualenv.py --no-wheel --no-pip --no-setuptools "$VENV_DIR"
source "$VENV_DIR/bin/activate"
# Now try to install setuptools
python bootstrap.py
python setup.py install
importlib; python_version<"2.7"
mock
pytest-flake8
pytest-virtualenv>=1.2.7
pytest>=3.0.2
virtualenv
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment