Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 781c540

Browse files
anntzerSidharthBansal
authored andcommitted
Add machinery to generate test-only wheels.
Generate a matplotlib.tests wheel that can be uploaded to PyPI as a separate PyPI package ("distribution", in distutils parlance), to make it possible to install tests and test data from PyPI. This is useful e.g. for mplcairo, whose test suite relies on matplotlib's one.
1 parent 5c13fb4 commit 781c540

3 files changed

Lines changed: 43 additions & 0 deletions

File tree

doc/devel/release_guide.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@ day), generate the tarball ::
277277
git checkout v2.0.0
278278
git clean -xfd
279279
python setup.py sdist
280+
# Generate test-only wheels.
281+
for dir in sub-wheels/*; do
282+
(cd "$dir" && python setup.py bdist_wheel)
283+
done
280284

281285
and copy all of the wheels into :file:`dist` directory. First, check
282286
that the dist files are OK ::
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Running ``python setup.py bdist_wheel`` (*not* ``pip wheel .``) generates a
2+
wheel for a ``matplotlib.tests`` distribution (in the distutils sense, i.e.
3+
a PyPI package) that can be installed alongside a main, test-less Matplotlib
4+
distribution.
5+
6+
Note that
7+
8+
- ``pip wheel`` doesn't work as that starts by copying the *current* directory
9+
to a temporary one (for isolation purposes), before we get to ``chdir`` back
10+
to the root directory.
11+
- ``python setup.py sdist`` doesn't work as that would pick up the
12+
``MANIFEST.in`` file in the root directory.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
from pathlib import Path
3+
import sys
4+
5+
6+
rootdir = str(Path(__file__).resolve().parents[2])
7+
sys.path.insert(0, rootdir)
8+
os.chdir(rootdir)
9+
10+
11+
from setuptools import setup, find_packages
12+
import versioneer
13+
14+
15+
__version__ = versioneer.get_version()
16+
17+
18+
if "sdist" in sys.argv:
19+
sys.exit("Only wheels can be generated.")
20+
setup(
21+
name="matplotlib.tests",
22+
version=__version__,
23+
package_dir={"": "lib"},
24+
packages=find_packages("lib", include=["*.tests"]),
25+
include_package_data=True,
26+
install_requires=["matplotlib=={}".format(__version__)]
27+
)

0 commit comments

Comments
 (0)