Skip to content

Commit eb001d9

Browse files
authored
Merge pull request #1083 from ocefpaf/appveyor
Appveyor
2 parents 9f2299a + 6fc1806 commit eb001d9

File tree

3 files changed

+83
-39
lines changed

3 files changed

+83
-39
lines changed

.appveyor.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
build: false
2+
3+
environment:
4+
matrix:
5+
- PYTHON: "C:\\Miniconda36-x64"
6+
PY: 3.7
7+
8+
init:
9+
- "ECHO %PYTHON_VERSION% %MINICONDA%"
10+
11+
install:
12+
# Install and configure miniconda.
13+
- "set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
14+
- conda config --set always_yes yes --set changeps1 no --set show_channel_urls true
15+
- conda update conda --quiet
16+
- conda config --add channels conda-forge --force
17+
- conda install pycryptosat
18+
- conda config --set safety_checks disabled
19+
20+
# Create the test env.
21+
- conda create --name TEST python=%PY% --file requirements.txt --file requirements-dev.txt
22+
- activate TEST
23+
24+
# Debug.
25+
- conda info --all
26+
- conda list
27+
28+
test_script:
29+
- pip install -e . --no-deps --force-reinstall
30+
- pytest -n 2 -rxXs tests

requirements-dev.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ pandas
2222
pillow
2323
pycodestyle
2424
pytest
25+
pytest-cov
26+
pytest-flake8
27+
pytest-xdist
2528
scipy
2629
selenium
2730
sphinx

tests/test_features.py

Lines changed: 50 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@
1616

1717
from six import text_type
1818

19+
import pytest
1920

20-
tmpl = """
21-
<!DOCTYPE html>
22-
<head>
23-
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
24-
</head>
25-
<body>
26-
</body>
27-
<script>
28-
</script>
29-
""" # noqa
21+
22+
@pytest.fixture
23+
def tmpl():
24+
yield ("""
25+
<!DOCTYPE html>
26+
<head>
27+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
28+
</head>
29+
<body>
30+
</body>
31+
<script>
32+
</script>
33+
""") # noqa
3034

3135

3236
# Root path variable
@@ -51,11 +55,12 @@ def test_figure_rendering():
5155
assert bounds == [[None, None], [None, None]], bounds
5256

5357

54-
def test_figure_html():
58+
def test_figure_html(tmpl):
5559
f = folium.Figure()
5660
out = f.render()
5761
out = os.linesep.join([s.strip() for s in out.splitlines() if s.strip()])
58-
assert out.strip() == tmpl.strip(), '\n' + out.strip() + '\n' + '-' * 80 + '\n' + tmpl.strip() # noqa
62+
tmpl = os.linesep.join([s.strip() for s in tmpl.splitlines() if s.strip()])
63+
assert out == tmpl, '\n' + out + '\n' + '-' * 80 + '\n' + tmpl
5964

6065
bounds = f.get_bounds()
6166
assert bounds == [[None, None], [None, None]], bounds
@@ -164,43 +169,49 @@ def test_get_vegalite_major_version():
164169

165170
assert vegalite_v1._get_vegalite_major_versions(spec_v1) == '1'
166171

167-
spec_no_version = {'config': {'view': {'height': 300, 'width': 400}},
168-
'data': {'name': 'data-aac17e868e23f98b5e0830d45504be45'},
169-
'datasets': {'data-aac17e868e23f98b5e0830d45504be45': [{'folium usage': 0,
170-
'happiness': 1.0},
171-
{'folium usage': 1,
172-
'happiness': 2.718281828459045},
173-
{'folium usage': 2,
174-
'happiness': 7.38905609893065},
175-
{'folium usage': 3,
176-
'happiness': 20.085536923187668},
177-
{'folium usage': 4,
178-
'happiness': 54.598150033144236},
179-
{'folium usage': 5,
180-
'happiness': 148.4131591025766},
181-
{'folium usage': 6,
182-
'happiness': 403.4287934927351},
183-
{'folium usage': 7,
184-
'happiness': 1096.6331584284585},
185-
{'folium usage': 8,
186-
'happiness': 2980.9579870417283},
187-
{'folium usage': 9,
188-
'happiness': 8103.083927575384}]},
189-
'encoding': {'x': {'field': 'folium usage', 'type': 'quantitative'},
190-
'y': {'field': 'happiness', 'type': 'quantitative'}},
191-
'mark': 'point'}
172+
spec_no_version = {
173+
'config': {
174+
'view': {'height': 300, 'width': 400}},
175+
'data': {'name': 'data-aac17e868e23f98b5e0830d45504be45'},
176+
'datasets': {
177+
'data-aac17e868e23f98b5e0830d45504be45': [
178+
{'folium usage': 0,
179+
'happiness': 1.0},
180+
{'folium usage': 1,
181+
'happiness': 2.718281828459045},
182+
{'folium usage': 2,
183+
'happiness': 7.38905609893065},
184+
{'folium usage': 3,
185+
'happiness': 20.085536923187668},
186+
{'folium usage': 4,
187+
'happiness': 54.598150033144236},
188+
{'folium usage': 5,
189+
'happiness': 148.4131591025766},
190+
{'folium usage': 6,
191+
'happiness': 403.4287934927351},
192+
{'folium usage': 7,
193+
'happiness': 1096.6331584284585},
194+
{'folium usage': 8,
195+
'happiness': 2980.9579870417283},
196+
{'folium usage': 9,
197+
'happiness': 8103.083927575384}]},
198+
'encoding': {'x': {'field': 'folium usage', 'type': 'quantitative'},
199+
'y': {'field': 'happiness', 'type': 'quantitative'}},
200+
'mark': 'point'
201+
}
192202

193203
vegalite_no_version = folium.features.VegaLite(spec_no_version)
194204

195205
assert vegalite_no_version._get_vegalite_major_versions(spec_no_version) is None
196206

207+
197208
# GeoJsonTooltip GeometryCollection
198209
def test_geojson_tooltip():
199210
m = folium.Map([30.5, -97.5], zoom_start=10)
200-
folium.GeoJson(os.path.join(rootpath, "kuntarajat.geojson"),
211+
folium.GeoJson(os.path.join(rootpath, 'kuntarajat.geojson'),
201212
tooltip=folium.GeoJsonTooltip(fields=['code', 'name'])
202213
).add_to(m)
203214
with warnings.catch_warnings(record=True) as w:
204215
warnings.simplefilter('always')
205216
m._repr_html_()
206-
assert issubclass(w[-1].category, UserWarning), "GeoJsonTooltip GeometryCollection test failed."
217+
assert issubclass(w[-1].category, UserWarning), 'GeoJsonTooltip GeometryCollection test failed.'

0 commit comments

Comments
 (0)