Skip to content

Commit

Permalink
Update integration tests (#4027)
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri authored Aug 25, 2023
2 parents 2733fc3 + beef518 commit c520238
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ jobs:
- name: Install OS-level dependencies
run: |
sudo apt-get update
sudo apt-get install build-essential gfortran libopenblas-dev
sudo apt-get install build-essential gfortran libopenblas-dev libyaml-dev
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down
1 change: 1 addition & 0 deletions newsfragments/4027.misc.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed ``pandas`` from integration tests.
1 change: 1 addition & 0 deletions newsfragments/4027.misc.2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added ``pyyaml``, ``charset-normalizer`` and ``protobuf`` to integration tests.
32 changes: 23 additions & 9 deletions setuptools/tests/integration/test_pip_install_sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,37 @@
# that `build-essential`, `gfortran` and `libopenblas-dev` are installed,
# due to their relevance to the numerical/scientific programming ecosystem)
EXAMPLES = [
("pandas", LATEST), # cython + custom build_ext
("pip", LATEST), # just in case...
("pytest", LATEST), # uses setuptools_scm
("mypy", LATEST), # custom build_py + ext_modules
# --- Popular packages: https://hugovk.github.io/top-pypi-packages/ ---
("botocore", LATEST),
("kiwisolver", "1.3.2"), # build_ext, version pinned due to setup_requires
("kiwisolver", LATEST), # build_ext
("brotli", LATEST), # not in the list but used by urllib3
("pyyaml", LATEST), # cython + custom build_ext + custom distclass
("charset-normalizer", LATEST), # uses mypyc, used by aiohttp
("protobuf", LATEST),
# When adding packages to this list, make sure they expose a `__version__`
# attribute, or modify the tests below
]


# Some packages have "optional" dependencies that modify their build behaviour
# and are not listed in pyproject.toml, others still use `setup_requires`
EXTRA_BUILD_DEPS = {"sphinx": ("babel>=1.3",), "kiwisolver": ("cppy>=1.1.0",)}
EXTRA_BUILD_DEPS = {
"pyyaml": ("Cython<3.0",), # constraint to avoid errors
"charset-normalizer": ("mypy>=1.4.1",), # no pyproject.toml available
}

EXTRA_ENV_VARS = {
"pyyaml": {"PYYAML_FORCE_CYTHON": "1"},
"charset-normalizer": {"CHARSET_NORMALIZER_USE_MYPYC": "1"},
}

IMPORT_NAME = {
"pyyaml": "yaml",
"protobuf": "google.protobuf",
}


VIRTUALENV = (sys.executable, "-m", "virtualenv")
Expand Down Expand Up @@ -103,9 +118,6 @@ def _debug_info():
request.addfinalizer(_debug_info)


ALREADY_LOADED = ("pytest", "mypy") # loaded by pytest/pytest-enabler


@pytest.mark.parametrize('package, version', EXAMPLES)
@pytest.mark.uses_network
def test_install_sdist(package, version, tmp_path, venv_python, setuptools_wheel):
Expand All @@ -119,11 +131,13 @@ def test_install_sdist(package, version, tmp_path, venv_python, setuptools_wheel

# Use a virtualenv to simulate PEP 517 isolation
# but install fresh setuptools wheel to ensure the version under development
run([*venv_pip, "install", "-I", setuptools_wheel])
run([*venv_pip, "install", *INSTALL_OPTIONS, sdist])
env = EXTRA_ENV_VARS.get(package, {})
run([*venv_pip, "install", "wheel", "-I", setuptools_wheel])
run([*venv_pip, "install", *INSTALL_OPTIONS, sdist], env)

# Execute a simple script to make sure the package was installed correctly
script = f"import {package}; print(getattr({package}, '__version__', 0))"
pkg = IMPORT_NAME.get(package, package).replace("-", "_")
script = f"import {pkg}; print(getattr({pkg}, '__version__', 0))"
run([venv_python, "-c", script])


Expand Down

0 comments on commit c520238

Please sign in to comment.