Skip to content

Commit bae64f7

Browse files
authored
Replace TravisCI tests with GitHub Actions (#524)
1 parent 9d6ade5 commit bae64f7

File tree

14 files changed

+168
-152
lines changed

14 files changed

+168
-152
lines changed

.appveyor.yml

-25
This file was deleted.

.github/workflows/test.yaml

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: tests
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- '*'
9+
10+
jobs:
11+
test_suite:
12+
name: Pytest on ${{ matrix.os }} with Python ${{ matrix.python-version }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: ['ubuntu-latest', 'windows-latest']
18+
python-version: [2.7, 3.6, 3.7]
19+
exclude:
20+
- os: windows-latest
21+
python-version: 2.7
22+
timeout-minutes: 30
23+
defaults:
24+
run:
25+
shell: bash -l {0}
26+
env:
27+
DESC: "Python ${{ matrix.python-version }} tests"
28+
HV_REQUIREMENTS: "unit_tests"
29+
PYTHON_VERSION: ${{ matrix.python-version }}
30+
CHANS_DEV: "-c pyviz/label/dev"
31+
CHANS: "-c pyviz"
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
steps:
34+
- uses: actions/checkout@v2
35+
with:
36+
fetch-depth: "100"
37+
- uses: actions/setup-python@v2
38+
with:
39+
auto-update-conda: true
40+
python-version: ${{ matrix.python-version }}
41+
- uses: conda-incubator/setup-miniconda@v2
42+
with:
43+
miniconda-version: "latest"
44+
- name: Fetch unshallow
45+
run: git fetch --prune --tags --unshallow
46+
- name: conda setup
47+
run: |
48+
conda config --set always_yes True
49+
conda install -c pyviz "pyctdev>=0.5"
50+
doit ecosystem_setup
51+
conda install nodejs
52+
doit env_create ${{ env.CHANS_DEV}} --python=${{ matrix.python-version }}
53+
- name: doit develop_install py2
54+
if: startsWith(matrix.python-version, 2.)
55+
run: |
56+
eval "$(conda shell.bash hook)"
57+
conda activate test-environment
58+
conda list
59+
doit develop_install -c pyviz/label/dev -o tests
60+
- name: doit develop_install py3
61+
if: startsWith(matrix.python-version, 3.)
62+
run: |
63+
eval "$(conda shell.bash hook)"
64+
conda activate test-environment
65+
conda list
66+
doit develop_install ${{ env.CHANS_DEV}} -o examples -o tests
67+
- name: pygraphviz
68+
if: contains(matrix.os, 'ubuntu')
69+
run: |
70+
eval "$(conda shell.bash hook)"
71+
conda activate test-environment
72+
conda install -c conda-forge pygraphviz
73+
- name: doit env_capture
74+
run: |
75+
eval "$(conda shell.bash hook)"
76+
conda activate test-environment
77+
doit env_capture
78+
- name: doit test_flakes
79+
run: |
80+
eval "$(conda shell.bash hook)"
81+
conda activate test-environment
82+
doit test_flakes
83+
- name: doit test_unit
84+
run: |
85+
eval "$(conda shell.bash hook)"
86+
conda activate test-environment
87+
doit test_unit
88+
- name: test examples ubuntu
89+
if: contains(matrix.os, 'ubuntu') && startsWith(matrix.python-version, 3.)
90+
run: |
91+
eval "$(conda shell.bash hook)"
92+
conda activate test-environment
93+
bokeh sampledata
94+
doit test_examples_extra
95+
- name: test examples windows
96+
if: contains(matrix.os, 'windows')
97+
run: |
98+
eval "$(conda shell.bash hook)"
99+
conda activate test-environment
100+
bokeh sampledata
101+
doit test_examples
102+
- name: codecov
103+
env:
104+
github-token: ${{ secrets.GITHUB_TOKEN }}
105+
if: startsWith(matrix.python-version, 3.)
106+
run: |
107+
eval "$(conda shell.bash hook)"
108+
conda activate test-environment
109+
coveralls

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ env:
1919
- PYTHON_VERSION=3.6
2020

2121
stages:
22-
- test
22+
- name: test
23+
if: tag =~ ^v(\d+|\.)+([a-z]|rc)?\d?$
2324
- name: docs
2425
if: tag =~ ^v(\d+|\.)*[^a-z]\d*$ OR tag = website
2526
- name: docs_dev

MANIFEST.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
include hvplot/.version
1+
include README.rst
22
include LICENSE
3+
include hvplot/.version
34
graft examples
45
global-exclude *.py[co]
56
global-exclude *~

examples/user_guide/NetworkX.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,8 @@
600600
"G.add_edge('c', 'f', weight=0.9)\n",
601601
"G.add_edge('a', 'd', weight=0.3)\n",
602602
"\n",
603-
"elarge = [(u, v) for (u, v, d) in G.edges(data=True) if d['weight'] > 0.5]\n",
604-
"esmall = [(u, v) for (u, v, d) in G.edges(data=True) if d['weight'] <= 0.5]\n",
603+
"elarge = [(u, v) for (u, v, attr) in G.edges(data=True) if attr['weight'] > 0.5]\n",
604+
"esmall = [(u, v) for (u, v, attr) in G.edges(data=True) if attr['weight'] <= 0.5]\n",
605605
"\n",
606606
"pos = nx.spring_layout(G) # positions for all nodes\n",
607607
"\n",

hvplot/converter.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,10 @@ def method_wrapper(ds, x, y):
10421042
name = data.name or self.label or self.value_label
10431043
dataset = Dataset(data, self.indexes, name)
10441044
else:
1045-
dataset = Dataset(data, self.indexes)
1045+
try:
1046+
dataset = Dataset(data, self.indexes)
1047+
except Exception:
1048+
dataset = Dataset(data)
10461049
dataset = dataset.redim(**self._redim)
10471050
obj = method(x, y)
10481051
obj._dataset = dataset

hvplot/intake.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import absolute_import
2+
13
from distutils.version import LooseVersion
24

35
from . import hvPlot, post_patch

hvplot/tests/testcharts.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010

1111
class TestChart2D(ComparisonTestCase):
12+
1213
def setUp(self):
1314
try:
1415
import numpy as np
@@ -76,7 +77,7 @@ def test_heatmap_2d_derived_x_and_y(self):
7677
class TestChart2DDask(TestChart2D):
7778

7879
def setUp(self):
79-
super().setUp()
80+
super(TestChart2DDask, self).setUp()
8081
try:
8182
import dask.dataframe as dd
8283
except:
@@ -250,27 +251,27 @@ def test_time_df_sorts_on_plot(self):
250251
scrambled = self.time_df.sample(frac=1)
251252
plot = scrambled.hvplot(x='time')
252253
assert (plot.data == self.time_df).all().all()
253-
assert (plot.data.time.diff()[1:].astype('int') > 0).all()
254+
assert len(plot.data.time.unique()) == len(plot.data.time)
254255

255256
def test_time_df_does_not_sort_on_plot_if_sort_date_off(self):
256257
scrambled = self.time_df.sample(frac=1)
257258
plot = scrambled.hvplot(x='time', sort_date=False)
258259
assert (plot.data == scrambled).all().all()
259-
assert not (plot.data.time.diff()[1:].astype('int') > 0).all()
260+
assert len(plot.data.time.unique()) == len(plot.data.time)
260261

261262
def test_time_df_sorts_on_plot_using_index_as_x(self):
262263
df = self.time_df.set_index('time')
263264
scrambled = df.sample(frac=1)
264265
plot = scrambled.hvplot()
265266
assert (plot.data['time'] == df.index).all()
266-
assert (plot.data.time.diff()[1:].astype('int') > 0).all()
267+
assert len(plot.data.time.unique()) == len(plot.data.time)
267268

268269
def test_time_df_does_not_sort_on_plot_if_sort_date_off_using_index_as_x(self):
269270
df = self.time_df.set_index('time')
270271
scrambled = df.sample(frac=1)
271272
plot = scrambled.hvplot(sort_date=False)
272273
assert (plot.data.time == scrambled.index).all().all()
273-
assert not (plot.data.time.diff()[1:].astype('int') > 0).all()
274+
assert len(plot.data.time.unique()) == len(plot.data.time)
274275

275276
def test_time_df_with_groupby_as_derived_datetime(self):
276277
plot = self.time_df.hvplot(groupby='time.dayofweek', dynamic=False)
@@ -306,7 +307,7 @@ def test_default_y_not_in_by(self):
306307
class TestChart1DDask(TestChart1D):
307308

308309
def setUp(self):
309-
super().setUp()
310+
super(TestChart1DDask, self).setUp()
310311
try:
311312
import dask.dataframe as dd
312313
except:

hvplot/tests/testgeo.py

+20-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
from unittest import TestCase, SkipTest, expectedFailure
24

35
import numpy as np
@@ -8,6 +10,8 @@
810
class TestGeo(TestCase):
911

1012
def setUp(self):
13+
if sys.platform == "win32":
14+
raise SkipTest("Skip geo tests on windows for now")
1115
try:
1216
import xarray as xr
1317
import rasterio # noqa
@@ -29,10 +33,14 @@ def assert_projection(self, plot, proj):
2933
opts = hv.Store.lookup_options('bokeh', plot, 'plot')
3034
assert opts.kwargs['projection'].proj4_params['proj'] == proj
3135

32-
def test_plot_with_crs_as_object(self):
33-
plot = self.da.hvplot.image('x', 'y', crs=self.crs)
34-
self.assertCRS(plot)
3536

37+
class TestCRSInference(TestGeo):
38+
39+
def setUp(self):
40+
if sys.platform == "win32":
41+
raise SkipTest("Skip CRS inference on Windows")
42+
super(TestCRSInference, self).setUp()
43+
3644
def test_plot_with_crs_as_proj_string(self):
3745
plot = self.da.hvplot.image('x', 'y', crs=self.da.crs)
3846
self.assertCRS(plot)
@@ -41,6 +49,13 @@ def test_plot_with_geo_as_true_crs_undefined(self):
4149
plot = self.da.hvplot.image('x', 'y', geo=True)
4250
self.assertCRS(plot)
4351

52+
53+
class TestProjections(TestGeo):
54+
55+
def test_plot_with_crs_as_object(self):
56+
plot = self.da.hvplot.image('x', 'y', crs=self.crs)
57+
self.assertCRS(plot)
58+
4459
def test_plot_with_crs_as_attr_str(self):
4560
da = self.da.copy()
4661
da.attrs = {'bar': self.crs}
@@ -59,12 +74,12 @@ def test_plot_with_geo_as_true_crs_no_crs_on_data_returns_default(self):
5974

6075
def test_plot_with_projection_as_string(self):
6176
da = self.da.copy()
62-
plot = da.hvplot.image('x', 'y', projection='Robinson')
77+
plot = da.hvplot.image('x', 'y', crs=self.crs, projection='Robinson')
6378
self.assert_projection(plot, 'robin')
6479

6580
def test_plot_with_projection_as_string_google_mercator(self):
6681
da = self.da.copy()
67-
plot = da.hvplot.image('x', 'y', projection='GOOGLE_MERCATOR')
82+
plot = da.hvplot.image('x', 'y', crs=self.crs, projection='GOOGLE_MERCATOR')
6883
self.assert_projection(plot, 'merc')
6984

7085
def test_plot_with_projection_as_invalid_string(self):

hvplot/tests/testnetworkx.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class TestOptions(TestCase):
1212
def setUp(self):
1313
# Create nodes (1-10) in unsorted order
1414
nodes = np.array([1, 4, 5, 10, 8, 9, 3, 7, 2, 6])
15-
edges = [*zip(nodes[:-1], nodes[1:])]
15+
edges = list(zip(nodes[:-1], nodes[1:]))
1616

1717
g = nx.Graph()
1818
g.add_nodes_from(nodes)

hvplot/tests/testtransforms.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ def test_pandas_transform(self):
2525
class TestXArrayTransforms(ComparisonTestCase):
2626

2727
def setUp(self):
28-
28+
2929
try:
30-
import xarray as xr
30+
import xarray as xr # noqa
3131
except:
3232
raise SkipTest('xarray not available')
3333
import hvplot.xarray # noqa
34-
34+
3535
def test_xarray_transform(self):
3636
import xarray as xr
3737
data = np.arange(0, 60).reshape(6, 10)
@@ -42,6 +42,3 @@ def test_xarray_transform(self):
4242
transforms=dict(value=hv.dim('value')*10)
4343
)
4444
self.assertEqual(img.data.value.data, da.data*10)
45-
46-
47-

hvplot/tests/testutil.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
Tests utilities to convert data and projections
33
"""
4+
import sys
5+
46
import numpy as np
57

68
from unittest import TestCase, SkipTest
@@ -195,6 +197,8 @@ def test_process_xarray_dataset_with_x_as_derived_datetime(self):
195197
class TestGeoUtil(TestCase):
196198

197199
def setUp(self):
200+
if sys.platform == "win32":
201+
raise SkipTest("Skip geo tests on windows for now")
198202
try:
199203
import geoviews # noqa
200204
import cartopy.crs as ccrs

0 commit comments

Comments
 (0)