Skip to content
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

Update test dependencies #2735

Merged
merged 14 commits into from
Jul 20, 2020
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
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ before_install:
else
sudo mkdir -p /usr/local/man
sudo chown -R "${USER}:admin" /usr/local/man
brew update
# brew update # do not update to save build time
brew install python ccache hdf5 proj geos openmpi netcdf
brew uninstall gdal postgis numpy
export PATH=/usr/local/opt/ccache/libexec:$PATH
Expand Down Expand Up @@ -68,7 +68,7 @@ install:
# pyproject.toml in cartopy.
# These versions are pinned, so we will need to update/remove them when
# the hack is no longer necessary.
$PIP install numpy==1.18.1 cython==0.29.6
$PIP install numpy==1.18.1 cython==0.29.14
CFLAGS="$CFLAGS -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" $PIP install -r tests/test_requirements.txt
fi
$PIP install -e .
Expand Down Expand Up @@ -116,14 +116,11 @@ jobs:
name: "MacOS: Unit Tests"
os: osx
osx_image: xcode10.1
language: generic # https://github.com/travis-ci/travis-ci/issues/2312
language: shell
env: PIP=pip3
cache:
pip: false
directories:
- directories:
- $HOME/Library/Caches/pip
# `cache` does not support `env`-like `global` so copy-paste from top
- $HOME/.ccache # https://github.com/travis-ci/travis-ci/issues/5853
script: nosetests -c nose_unit.cfg

after_success:
Expand Down
2 changes: 1 addition & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ html:
ifneq ($(READTHEDOCS),True)
SPHINX_APIDOC_OPTIONS=members,undoc-members,inherited-members,show-inheritance sphinx-apidoc \
-o source/reference/api/ \
-e ../yt ../yt/extern* $(shell find ../yt -name "*tests*" -type d) ../yt/utilities/voropp*
-e ../yt ../yt/extern* $(shell find ../yt -name "*tests*" -type d) ../yt/utilities/voropp* ../yt/analysis_modules/*
endif
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
Expand Down
10 changes: 5 additions & 5 deletions tests/test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
astropy==3.0.5
astropy==3.2.3
codecov==2.0.15
coverage==4.5.1
coverage==4.5.4
fastcache==1.0.2
glueviz==0.13.3
h5py==2.10.0
ipython==7.1.1
matplotlib==3.1.3
matplotlib==3.3.0
Copy link
Member

Choose a reason for hiding this comment

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

For now it's alright but maybe we should future proof this and use their bug fixes releases as soon as they come out ?

Suggested change
matplotlib==3.3.0
matplotlib~=3.3

mock==2.0.0; python_version < '3.0'
nose-timer==0.7.3
nose-timer==1.0.0
nose==1.3.7
pandas==0.23.4
pandas==0.25.3
pytest~=5.2
requests==2.20.0
scipy==1.3.3
Expand Down
5 changes: 3 additions & 2 deletions tests/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ answer_tests:
- yt/frontends/enzo/tests/test_outputs.py:test_ecp
- yt/frontends/enzo/tests/test_outputs.py:test_nuclei_density_fields

local_enzo_p_007:
local_enzo_p_008: # PR 2735
- yt/frontends/enzo_p/tests/test_outputs.py:test_hello_world
- yt/frontends/enzo_p/tests/test_outputs.py:test_particle_fields

Expand Down Expand Up @@ -86,7 +86,7 @@ answer_tests:
- yt/frontends/owls/tests/test_outputs.py:test_snapshot_033
- yt/frontends/owls/tests/test_outputs.py:test_OWLS_particlefilter

local_pw_029:
local_pw_030: # PR 2735
- yt/visualization/tests/test_plotwindow.py:test_attributes
- yt/visualization/tests/test_plotwindow.py:test_attributes_wt
- yt/visualization/tests/test_particle_plot.py:test_particle_projection_answers
Expand Down Expand Up @@ -162,5 +162,6 @@ other_tests:
unittests:
- '--exclude=test_mesh_slices' # disable randomly failing test
- '--exclude=test_load_from_path' # py2
- '--exclude=test_Snipshot' # until PR 2645 is merged
cookbook:
- 'doc/source/cookbook/tests/test_cookbook.py'
12 changes: 8 additions & 4 deletions yt/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import urllib.parse
import urllib.request
import warnings
from distutils.version import LooseVersion
from functools import lru_cache, wraps
from math import ceil, floor
from numbers import Number as numeric_type
Expand Down Expand Up @@ -1265,10 +1266,13 @@ def matplotlib_style_context(style_name=None, after_reset=False):
available, returns a dummy context manager.
"""
if style_name is None:
style_name = {
"mathtext.fontset": "cm",
"mathtext.fallback_to_cm": True,
}
import matplotlib

style_name = {"mathtext.fontset": "cm"}
if LooseVersion(matplotlib.__version__) >= LooseVersion("3.3.0"):
style_name["mathtext.fallback"] = "cm"
else:
style_name["mathtext.fallback_to_cm"] = True
try:
import matplotlib.style

Expand Down
12 changes: 8 additions & 4 deletions yt/geometry/oct_container.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -727,12 +727,13 @@ cdef class OctreeContainer:
np.int64_t offset = 0):
cdef np.ndarray[np.float64_t, ndim=2] source
cdef np.ndarray[np.float64_t, ndim=1] dest
cdef int i
cdef int i, lvl

for key in dest_fields:
dest = dest_fields[key]
source = source_fields[key]
for i, lvl in enumerate(levels):
for i in range(levels.shape[0]):
lvl = levels[i]
if lvl != level: continue
if file_inds[i] < 0:
dest[i + offset] = np.nan
Expand Down Expand Up @@ -819,13 +820,16 @@ cdef class OctreeContainer:
"""
cdef np.ndarray[np.float64_t, ndim=2] source
cdef np.ndarray[np.float64_t, ndim=1] dest
cdef int i, count
cdef int i, count, lev
cdef np.int32_t dom

for key in dest_fields:
dest = dest_fields[key]
source = source_fields[key]
count = 0
for i, (lev, dom) in enumerate(zip(levels, domains)):
for i in range(levels.shape[0]):
lev = levels[i]
dom = domains[i]
if lev != level or dom != domain: continue
count += 1
if file_inds[i] < 0:
Expand Down
10 changes: 8 additions & 2 deletions yt/utilities/command_line.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# isort: skip-file
Copy link
Member

Choose a reason for hiding this comment

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

note that it'd be easier to manage if instead of this comment, the file was added to isort's ignore list in setup.cfg, but it shouldn't hold this PR back.

@matthewturk , can you do it in #2756 ?

import argparse
import base64
import getpass
Expand Down Expand Up @@ -28,7 +29,7 @@
mylog,
update_hg_or_git,
)
from yt.startup_tasks import parser, subparsers

from yt.utilities.configure import set_config
from yt.utilities.exceptions import (
YTCommandRequiresModule,
Expand All @@ -38,7 +39,12 @@
from yt.utilities.metadata import get_metadata
from yt.visualization.plot_window import ProjectionPlot, SlicePlot

ytcfg["yt", "__command_line"] = "True"
# isort: off
# This needs to be set before importing startup_tasks
ytcfg["yt", "__command_line"] = "True" # isort: skip
from yt.startup_tasks import parser, subparsers # isort: skip # noqa: E402

# isort: on

# loading field plugins for backward compatibility, since this module
# used to do "from yt.mods import *"
Expand Down
2 changes: 1 addition & 1 deletion yt/utilities/lib/pixelization_routines.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def pixelize_cartesian(np.float64_t[:,:] buff,
# conservative about the iteration indices.
# This will reduce artifacts if we ever move to
# compositing instead of replacing bitmaps.
if overlap1 * overlap2 == 0.0: continue
if overlap1 * overlap2 < 1.e-6: continue
buff[i,j] += (dsp * overlap1) * overlap2
else:
buff[i,j] = dsp
Expand Down
2 changes: 1 addition & 1 deletion yt/utilities/png_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def call_png_write_png(buffer, fileobj, dpi):
try:
_png.write_png(buffer, fileobj, dpi)
except NameError:
Image.fromarray(buffer).save(fileobj, dpi=(dpi, dpi))
Image.fromarray(buffer).save(fileobj, dpi=(dpi, dpi), format="png")


def write_png(buffer, filename, dpi=100):
Expand Down
8 changes: 7 additions & 1 deletion yt/utilities/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,18 @@ def testConfigCommands(self):
if mock is None:
return

def remove_spaces_and_breaks(s):
return "".join(s.split())

self.assertFalse(os.path.exists(CURRENT_CONFIG_FILE))

info = self._runYTConfig(["--help"])
self.assertEqual(info["rc"], 0)
self.assertEqual(info["stderr"], "")
self.assertIn("Get and set configuration values for yt", info["stdout"])
self.assertIn(
remove_spaces_and_breaks("Get and set configuration values for yt"),
remove_spaces_and_breaks(info["stdout"]),
)

info = self._runYTConfig(["list"])
self.assertEqual(info["rc"], 0)
Expand Down
4 changes: 3 additions & 1 deletion yt/visualization/base_plot_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ def save(self, name, mpl_kwargs=None, canvas=None):

if mpl_kwargs is None:
mpl_kwargs = {}
if "papertype" not in mpl_kwargs:
if "papertype" not in mpl_kwargs and LooseVersion(
matplotlib.__version__
) < LooseVersion("3.3.0"):
mpl_kwargs["papertype"] = "auto"

suffix = get_image_suffix(name)
Expand Down