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

Used @attr(optional=1) and SkipTest to skip non-core tests #1461

Merged
merged 9 commits into from
May 19, 2017

Conversation

jlstevens
Copy link
Contributor

This PR aims to address issue #1420. It was more work than expected!

Tests no longer error if you install only core holoviews (i.e param and numpy) as installed with:

pip install holoviews
conda install nose

And run nosetests -a '!optional'

There is one exception though, you get this failure if pandas isn't installed:

======================================================================
ERROR: test_idxmapping_groupby_unsorted (tests.testndmapping.NdIndexableMappingTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jstevens/Desktop/development/holoviews/tests/testndmapping.py", line 103, in test_idxmapping_groupby_unsorted
    grouped = MultiDimensionalMapping(data, sort=False, kdims=['X', 'Y']).groupby('Y')
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/core/ndmapping.py", line 285, in groupby
    group_type, sort=True, **kwargs)
  File "/Users/jstevens/miniconda2/envs/testfix5/lib/python2.7/site-packages/param/parameterized.py", line 1888, in __new__
    return inst.__call__(*args,**params)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/core/util.py", line 1326, in __call__
    group_type, sort=sort, **kwargs)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/core/util.py", line 1361, in groupby_python
    for k, v in iterative_select(ndmapping, dim_names, selects)]
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/core/util.py", line 1042, in iterative_select
    items.append((s, obj.select(**{dimensions[-1]: s[-1]})))
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/core/dimension.py", line 994, in select
    selection = self[tuple(select)]
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/core/ndmapping.py", line 526, in __getitem__
    return self._dataslice(self.data[map_slice], data_slice)
TypeError: unhashable type

Note that I also added a fix to unique_array in this PR.

Oddly, I get three failures with matplotlib when pandas is missing, but only when installing using conda install -c ioam holoviews (pip + matplotlib without pandas seems fine!):

======================================================================
ERROR: test_idxmapping_groupby_unsorted (tests.testndmapping.NdIndexableMappingTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jstevens/Desktop/development/holoviews/tests/testndmapping.py", line 103, in test_idxmapping_groupby_unsorted
    grouped = MultiDimensionalMapping(data, sort=False, kdims=['X', 'Y']).groupby('Y')
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/core/ndmapping.py", line 285, in groupby
    group_type, sort=True, **kwargs)
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/param/parameterized.py", line 1888, in __new__
    return inst.__call__(*args,**params)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/core/util.py", line 1326, in __call__
    group_type, sort=sort, **kwargs)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/core/util.py", line 1361, in groupby_python
    for k, v in iterative_select(ndmapping, dim_names, selects)]
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/core/util.py", line 1042, in iterative_select
    items.append((s, obj.select(**{dimensions[-1]: s[-1]})))
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/core/dimension.py", line 994, in select
    selection = self[tuple(select)]
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/core/ndmapping.py", line 526, in __getitem__
    return self._dataslice(self.data[map_slice], data_slice)
TypeError: unhashable type

======================================================================
ERROR: test_curve_datetime64 (tests.testplotinstantiation.TestMPLPlotInstantiation)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jstevens/Desktop/development/holoviews/tests/testplotinstantiation.py", line 182, in test_curve_datetime64
    plot = mpl_renderer.get_plot(curve)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/renderer.py", line 178, in get_plot
    plot.update(0)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/mpl/plot.py", line 243, in update
    return self.initialize_plot()
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/mpl/plot.py", line 42, in wrapper
    return f(self, *args, **kwargs)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/mpl/element.py", line 492, in initialize_plot
    **axis_kwargs)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/mpl/element.py", line 198, in _finalize_axis
    self._finalize_ticks(axis, dimensions, xticks, yticks, zticks)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/mpl/element.py", line 241, in _finalize_ticks
    rotation=self.xrotation)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/mpl/element.py", line 423, in _set_axis_ticks
    for tick in axis.get_ticklabels():
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/axis.py", line 1237, in get_ticklabels
    return self.get_majorticklabels()
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/axis.py", line 1191, in get_majorticklabels
    ticks = self.get_major_ticks()
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/axis.py", line 1320, in get_major_ticks
    numticks = len(self.get_major_locator()())
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/dates.py", line 986, in __call__
    self.refresh()
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/dates.py", line 1006, in refresh
    dmin, dmax = self.viewlim_to_dt()
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/dates.py", line 763, in viewlim_to_dt
    return num2date(vmin, self.tz), num2date(vmax, self.tz)
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/dates.py", line 401, in num2date
    return _from_ordinalf(x, tz)
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/dates.py", line 254, in _from_ordinalf
    dt = datetime.datetime.fromordinal(ix).replace(tzinfo=UTC)
OverflowError: signed integer is greater than maximum

======================================================================
ERROR: test_curve_heterogeneous_datetime_types_overlay (tests.testplotinstantiation.TestMPLPlotInstantiation)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jstevens/Desktop/development/holoviews/tests/testplotinstantiation.py", line 204, in test_curve_heterogeneous_datetime_types_overlay
    plot = mpl_renderer.get_plot(curve_dt*curve_dt64)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/renderer.py", line 178, in get_plot
    plot.update(0)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/mpl/plot.py", line 243, in update
    return self.initialize_plot()
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/mpl/plot.py", line 42, in wrapper
    return f(self, *args, **kwargs)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/mpl/element.py", line 838, in initialize_plot
    title=self._format_title(key))
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/mpl/element.py", line 198, in _finalize_axis
    self._finalize_ticks(axis, dimensions, xticks, yticks, zticks)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/mpl/element.py", line 241, in _finalize_ticks
    rotation=self.xrotation)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/plotting/mpl/element.py", line 423, in _set_axis_ticks
    for tick in axis.get_ticklabels():
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/axis.py", line 1237, in get_ticklabels
    return self.get_majorticklabels()
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/axis.py", line 1191, in get_majorticklabels
    ticks = self.get_major_ticks()
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/axis.py", line 1320, in get_major_ticks
    numticks = len(self.get_major_locator()())
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/dates.py", line 986, in __call__
    self.refresh()
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/dates.py", line 1006, in refresh
    dmin, dmax = self.viewlim_to_dt()
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/dates.py", line 763, in viewlim_to_dt
    return num2date(vmin, self.tz), num2date(vmax, self.tz)
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/dates.py", line 401, in num2date
    return _from_ordinalf(x, tz)
  File "/Users/jstevens/miniconda2/envs/testfix6/lib/python2.7/site-packages/matplotlib/dates.py", line 254, in _from_ordinalf
    dt = datetime.datetime.fromordinal(ix).replace(tzinfo=UTC)
OverflowError: signed integer is less than minimum

======================================================================
FAIL: test_curve_dt_datetime (tests.testplotinstantiation.TestMPLPlotInstantiation)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jstevens/Desktop/development/holoviews/tests/testplotinstantiation.py", line 197, in test_curve_dt_datetime
    self.assertEqual(plot.handles['axis'].get_xlim(), (735964.0, 735973.0))
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/element/comparison.py", line 81, in assertEqual
    asserter(first, second)
  File "/Users/jstevens/Desktop/development/holoviews/holoviews/element/comparison.py", line 233, in compare_tuples
    raise AssertionError(msg or '%s != %s' % (repr(t1), repr(t2)))
AssertionError: (735963.55000000005, 735973.44999999995) != (735964.0, 735973.0)

----------------------------------------------------------------------
Ran 1515 tests in 25.456s

There is also the odd issue about '#008000' != u'green' in Bokeh (#1460) but I'm ignoring that.

@jlstevens
Copy link
Contributor Author

@philippjfr I think this PR is ready for review.

Alternatively, if you have fixes for the above issues I am happy to rebase this PR if they are merged into master.

@jlstevens
Copy link
Contributor Author

@philippjfr As long as you are happy with me inlining the imports in comms.py, I think it is actually ready to merge this time (once the tests are green).

@jlstevens
Copy link
Contributor Author

I removed the optional test filter on Travis which prompted me to remove the SHA tests: testwidgets.py now needs to be replaced with something better.

I also update the size tuples for the matplotlib tests. Unfortunately the sizes reported on travis don't quite match the ones generated on my laptop.

@jlstevens
Copy link
Contributor Author

Tests are now green. Ready to merge.

@philippjfr
Copy link
Member

Great, thanks for doing this. Looks good to me, merging.

@philippjfr philippjfr merged commit d34458d into master May 19, 2017
@philippjfr philippjfr deleted the test_annotation branch May 25, 2017 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants