Skip to content

Simplify appveyor to only use conda #24397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@ environment:
PYTHONIOENCODING: UTF-8
PYTEST_ARGS: -raR --numprocesses=auto --timeout=300 --durations=25
--cov-report= --cov=lib --log-level=DEBUG
PINNEDVERS: "pyzmq!=21.0.0,!=22.0.0"

matrix:
- PYTHON_VERSION: "3.8"
CONDA_INSTALL_LOCN: "C:\\Miniconda3-x64"
TEST_ALL: "no"
EXTRAREQS: "-r requirements/testing/extra.txt"
- PYTHON_VERSION: "3.9"
CONDA_INSTALL_LOCN: "C:\\Miniconda3-x64"
TEST_ALL: "no"
EXTRAREQS: "-r requirements/testing/extra.txt"

# We always use a 64-bit machine, but can build x86 distributions
# with the PYTHON_ARCH variable
Expand All @@ -52,19 +49,13 @@ install:
- conda config --prepend channels conda-forge

# For building, use a new environment
- conda create -q -n test-environment python=%PYTHON_VERSION% tk "pip<22.0"
- activate test-environment
# pull pywin32 from conda because on py38 there is something wrong with finding
# the dlls when installed from pip
# Add python version to environment
# `^ ` escapes spaces for indentation
- echo ^ ^ - python=%PYTHON_VERSION% >> environment.yml
- conda env create -f environment.yml
- activate mpl-dev
- conda install -c conda-forge pywin32
# install pyqt from conda-forge
- conda install -c conda-forge pyqt
- echo %PYTHON_VERSION% %TARGET_ARCH%
# Install dependencies from PyPI.
- python -m pip install --upgrade -r requirements/testing/all.txt %EXTRAREQS% %PINNEDVERS%
# Install optional dependencies from PyPI.
# Sphinx is needed to run sphinxext tests
- python -m pip install --upgrade sphinx
# Show the installed packages + versions
- conda list

Expand Down Expand Up @@ -104,7 +95,7 @@ artifacts:
type: zip

on_finish:
- pip install codecov
- conda install codecov
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely

Suggested change
- conda install codecov
- conda install -c conda-forge codecov

because we don't want to mix conda forge and main channel.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conda forge is actually configured by the environment, so everything is conda-forge. The earlier instance of installing win32 could actually remove the explicit -c conda-forge

https://ci.appveyor.com/project/matplotlib/matplotlib/builds/45337448/job/aie7c1u8m0pf3nf6#L1893

Copy link
Member

@timhoffm timhoffm Nov 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does conda say that the channel config from an environment.yml is preseved? I just tested with a minimal

name: cftest
channels:
    - conda-forge
dependencies:
    - python=3.7

and when I do a conda install numpy in that environment, conda wants to install from the main channel.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, its probably because we prepend conda-forge to the base channels list before creating the environment:

- conda config --prepend channels conda-forge

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that should be it.

- codecov -e PYTHON_VERSION PLATFORM

on_failure:
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies:
- coverage
- flake8>=3.8
- flake8-docstrings>=1.4.0
- gtk3
- gtk4
- ipykernel
- nbconvert[execute]!=6.0.0,!=6.0.1
- nbformat!=5.0.0,!=5.0.1
Expand Down
7 changes: 7 additions & 0 deletions lib/matplotlib/tests/test_backends_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ def test_interactive_backend(env, toolbar):
if env["MPLBACKEND"] == "macosx":
if toolbar == "toolmanager":
pytest.skip("toolmanager is not implemented for macosx.")
if env["MPLBACKEND"] == "wx":
pytest.skip("wx backend is deprecated; tests failed on appveyor")
proc = _run_helper(_test_interactive_impl,
json.dumps({"toolbar": toolbar}),
timeout=_test_timeout,
Expand Down Expand Up @@ -560,6 +562,8 @@ def _test_figure_leak():


# TODO: "0.1" memory threshold could be reduced 10x by fixing tkagg
@pytest.mark.skipif(sys.platform == "win32",
reason="appveyor tests fail; gh-22988 suggests reworking")
@pytest.mark.parametrize("env", _get_testable_interactive_backends())
@pytest.mark.parametrize("time_mem", [(0.0, 2_000_000), (0.1, 30_000_000)])
def test_figure_leak_20490(env, time_mem):
Expand All @@ -568,6 +572,9 @@ def test_figure_leak_20490(env, time_mem):
# We haven't yet directly identified the leaks so test with a memory growth
# threshold.
pause_time, acceptable_memory_leakage = time_mem
if env["MPLBACKEND"] == "wx":
pytest.skip("wx backend is deprecated; tests failed on appveyor")

if env["MPLBACKEND"] == "macosx" or (
env["MPLBACKEND"] == "tkagg" and sys.platform == 'darwin'
):
Expand Down
3 changes: 2 additions & 1 deletion lib/matplotlib/tests/test_font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def test_otf():
assert res == is_opentype_cff_font(f.fname)


@pytest.mark.skipif(not has_fclist, reason='no fontconfig installed')
@pytest.mark.skipif(sys.platform == "win32" or not has_fclist,
reason='no fontconfig installed')
def test_get_fontconfig_fonts():
assert len(_get_fontconfig_fonts()) > 1

Expand Down
14 changes: 10 additions & 4 deletions lib/matplotlib/tests/test_getattr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
import matplotlib
import pytest

# Get the names of all matplotlib submodules, except for the unit tests.
module_names = [m.name for m in walk_packages(path=matplotlib.__path__,
prefix=f'{matplotlib.__name__}.')
if not m.name.startswith(__package__)]
# Get the names of all matplotlib submodules,
# except for the unit tests and private modules.
module_names = [
m.name
for m in walk_packages(
path=matplotlib.__path__, prefix=f'{matplotlib.__name__}.'
)
if not m.name.startswith(__package__)
and not any(x.startswith('_') for x in m.name.split('.'))
]


@pytest.mark.parametrize('module_name', module_names)
Expand Down