Skip to content

Commit 772c4ee

Browse files
committed
Fixing test dependencies for stability
1 parent 55d4760 commit 772c4ee

14 files changed

+509
-360
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,16 @@ Then, add the following line to your `~/.bashrc`:
125125
eval "$(register-python-argcomplete nextplot)"
126126
```
127127

128-
## Development setup
128+
## Tests
129129

130-
### Install development dependencies
130+
Tests are located in `tests/` and can be run via `python -m pytest`. Update test
131+
expectations (golden files) by running `UPDATE=1 python test_cli.py` from the
132+
test directory. Tests require specific versions of the dependencies to be
133+
installed. These can be installed via `pip install -r requirements-dev.txt`.
134+
It is recommended to update the expectations in a docker container to avoid
135+
messing up local dependencies. This can be done by running the following
136+
commands:
131137

132138
```bash
133-
pip install -r requirements-dev.txt
139+
docker run --rm -it -v $(pwd):/app -w /app python:3.9 bash -c "pip install -r requirements-dev.txt && cd tests && UPDATE=1 python test_cli.py"
134140
```
135-
136-
### Tests
137-
138-
Tests are located in `tests/` and can be run via `python -m pytest`. Update test
139-
expectations (golden files) by running `UPDATE=1 python test_cli.py` from the
140-
test directory.

requirements-dev.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
argcomplete>=2.0.0
2-
colorutils>=0.3.0
3-
folium>=0.12.1
4-
jsonpath_ng>=1.5.3
5-
kaleido>=0.2.1
6-
numpy>=1.22.3
7-
plotly>=5.7.0
8-
scipy>=1.8.0
9-
pytest>=7.1.1
10-
imagehash>=4.2.1
11-
ruff>=0.1.7
12-
hatch>=1.9.1
1+
argcomplete==2.0.0
2+
colorutils==0.3.0
3+
folium==0.12.1
4+
jsonpath_ng==1.5.3
5+
kaleido==0.2.1
6+
numpy==1.22.3
7+
plotly==5.7.0
8+
scipy==1.8.0
9+
pytest==7.1.1
10+
imagehash==4.3.1
11+
ruff==0.1.7
12+
hatch==1.9.1

tests/testdata/fleet-cloud-comparison.html.golden

Lines changed: 61 additions & 4 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f0f081e3796a039f
1+
f0f281e3796a031f

tests/testdata/paris-cluster.map.html.golden

Lines changed: 31 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
1313
<style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>
14-
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.9.3/dist/leaflet.js"></script>
15-
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
16-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js"></script>
14+
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>
15+
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
16+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
1717
<script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>
18-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.9.3/dist/leaflet.css"/>
19-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css"/>
20-
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"/>
21-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css"/>
18+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>
19+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>
20+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>
21+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>
2222
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>
2323
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>
2424

@@ -32,7 +32,6 @@
3232
left: 0.0%;
3333
top: 0.0%;
3434
}
35-
.leaflet-container { font-size: 1rem; }
3635
</style>
3736

3837
</head>
@@ -64,44 +63,32 @@
6463

6564

6665
var tile_layer_ = L.tileLayer(
67-
"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png",
68-
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors \u0026copy; \u003ca href=\"https://carto.com/attributions\"\u003eCARTO\u003c/a\u003e", "detectRetina": false, "maxNativeZoom": 20, "maxZoom": 20, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abcd", "tms": false}
69-
);
70-
71-
72-
tile_layer_.addTo(map_);
66+
"https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
67+
{"attribution": "\u0026copy; \u003ca href=\"http://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors \u0026copy; \u003ca href=\"http://cartodb.com/attributions\"\u003eCartoDB\u003c/a\u003e, CartoDB \u003ca href =\"http://cartodb.com/attributions\"\u003eattributions\u003c/a\u003e", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
68+
).addTo(map_);
7369

7470

7571
var tile_layer_ = L.tileLayer(
76-
"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",
77-
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors \u0026copy; \u003ca href=\"https://carto.com/attributions\"\u003eCARTO\u003c/a\u003e", "detectRetina": false, "maxNativeZoom": 20, "maxZoom": 20, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abcd", "tms": false}
78-
);
79-
80-
81-
tile_layer_.addTo(map_);
72+
"https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png",
73+
{"attribution": "\u0026copy; \u003ca href=\"http://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors \u0026copy; \u003ca href=\"http://cartodb.com/attributions\"\u003eCartoDB\u003c/a\u003e, CartoDB \u003ca href =\"http://cartodb.com/attributions\"\u003eattributions\u003c/a\u003e", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
74+
).addTo(map_);
8275

8376

8477
var tile_layer_ = L.tileLayer(
85-
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
86-
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
87-
);
88-
89-
90-
tile_layer_.addTo(map_);
78+
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
79+
{"attribution": "Data by \u0026copy; \u003ca href=\"http://openstreetmap.org\"\u003eOpenStreetMap\u003c/a\u003e, under \u003ca href=\"http://www.openstreetmap.org/copyright\"\u003eODbL\u003c/a\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
80+
).addTo(map_);
9181

9282

9383
var tile_layer_ = L.tileLayer(
9484
"https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}{r}.png",
9585
{"attribution": "\u003ca href=\"http://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
96-
);
97-
98-
99-
tile_layer_.addTo(map_);
86+
).addTo(map_);
10087

10188

10289
var feature_group_ = L.featureGroup(
10390
{}
104-
);
91+
).addTo(map_);
10592

10693

10794
var polygon_ = L.polygon(
@@ -113,10 +100,8 @@
113100
var popup_ = L.popup({"autoClose": false, "closeOnClick": false, "maxWidth": 450});
114101

115102

116-
117-
var html_ = $(`<div id="html_" style="width: 100.0%; height: 100.0%;"><p>Cluster: 0 / 2</br>Cluster points: 7</br>Cluster diameter: 5.10 km (3.17 miles)</br></p></div>`)[0];
118-
popup_.setContent(html_);
119-
103+
var html_ = $(`<div id="html_" style="width: 100.0%; height: 100.0%;"><p>Cluster: 0 / 2</br>Cluster points: 7</br>Cluster diameter: 5.10 km (3.17 miles)</br></p></div>`)[0];
104+
popup_.setContent(html_);
120105

121106

122107
polygon_.bindPopup(popup_)
@@ -125,12 +110,9 @@
125110

126111

127112

128-
feature_group_.addTo(map_);
129-
130-
131113
var feature_group_ = L.featureGroup(
132114
{}
133-
);
115+
).addTo(map_);
134116

135117

136118
var polygon_ = L.polygon(
@@ -142,10 +124,8 @@
142124
var popup_ = L.popup({"autoClose": false, "closeOnClick": false, "maxWidth": 450});
143125

144126

145-
146-
var html_ = $(`<div id="html_" style="width: 100.0%; height: 100.0%;"><p>Cluster: 1 / 2</br>Cluster points: 5</br>Cluster diameter: 4.47 km (2.78 miles)</br></p></div>`)[0];
147-
popup_.setContent(html_);
148-
127+
var html_ = $(`<div id="html_" style="width: 100.0%; height: 100.0%;"><p>Cluster: 1 / 2</br>Cluster points: 5</br>Cluster diameter: 4.47 km (2.78 miles)</br></p></div>`)[0];
128+
popup_.setContent(html_);
149129

150130

151131
polygon_.bindPopup(popup_)
@@ -154,13 +134,10 @@
154134

155135

156136

157-
feature_group_.addTo(map_);
158-
159-
160-
var layer_control__layers = {
137+
var layer_control_ = {
161138
base_layers : {
162139
"cartodbpositron" : tile_layer_,
163-
"cartodbdarkmatter" : tile_layer_,
140+
"cartodbdark_matter" : tile_layer_,
164141
"openstreetmap" : tile_layer_,
165142
"DarkMatter no labels" : tile_layer_,
166143
},
@@ -169,12 +146,14 @@
169146
"Cluster 2" : feature_group_,
170147
},
171148
};
172-
let layer_control_ = L.control.layers(
173-
layer_control__layers.base_layers,
174-
layer_control__layers.overlays,
149+
L.control.layers(
150+
layer_control_.base_layers,
151+
layer_control_.overlays,
175152
{"autoZIndex": true, "collapsed": true, "position": "topright"}
176153
).addTo(map_);
177-
154+
tile_layer_.remove();
155+
tile_layer_.remove();
156+
tile_layer_.remove();
178157

179158
</script>
180159
</html>

tests/testdata/paris-cluster.plot.html.golden

Lines changed: 61 additions & 4 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)