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

Fix windows tests #341

Merged
merged 8 commits into from
Nov 21, 2022
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
6 changes: 3 additions & 3 deletions src/raster/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,17 +308,17 @@ fn test_create_with_band_type_with_options() {
},
];

let tmp_filename = "/tmp/test.tif";
let tmp_filename = TempFixture::empty("test.tif");
{
let dataset = driver
.create_with_band_type_with_options::<u8, _>(tmp_filename, 256, 256, 1, &options)
.create_with_band_type_with_options::<u8, _>(&tmp_filename, 256, 256, 1, &options)
.unwrap();
let rasterband = dataset.rasterband(1).unwrap();
let block_size = rasterband.block_size();
assert_eq!(block_size, (128, 64));
}

let dataset = Dataset::open(Path::new(tmp_filename)).unwrap();
let dataset = Dataset::open(tmp_filename).unwrap();
let key = "INTERLEAVE";
let domain = "IMAGE_STRUCTURE";
let meta = dataset.metadata_item(key, domain);
Expand Down
31 changes: 17 additions & 14 deletions src/vector/vector_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use super::{
OGRwkbGeometryType, OwnedLayer,
};
use crate::spatial_ref::SpatialRef;
use crate::test_utils::TempFixture;
use crate::{assert_almost_eq, Dataset, DatasetOptions, GdalOpenFlags};
mod convert_geo;
mod sql;
Expand Down Expand Up @@ -788,17 +789,19 @@ mod tests {
// dataset is closed here
}

let ds = Dataset::open(fixture!("output.geojson")).unwrap();
{
let ds = Dataset::open(fixture!("output.geojson")).unwrap();
let mut layer = ds.layer(0).unwrap();
let ft = layer.features().next().unwrap();
assert_eq!(ft.geometry().wkt().unwrap(), "POINT (1 2)");
assert_eq!(
ft.field("Name").unwrap().unwrap().into_string(),
Some("Feature 1".to_string())
);
assert_eq!(ft.field("Value").unwrap().unwrap().into_real(), Some(45.78));
assert_eq!(ft.field("Int_value").unwrap().unwrap().into_int(), Some(1));
}
fs::remove_file(fixture!("output.geojson")).unwrap();
let mut layer = ds.layer(0).unwrap();
let ft = layer.features().next().unwrap();
assert_eq!(ft.geometry().wkt().unwrap(), "POINT (1 2)");
assert_eq!(
ft.field("Name").unwrap().unwrap().into_string(),
Some("Feature 1".to_string())
);
assert_eq!(ft.field("Value").unwrap().unwrap().into_real(), Some(45.78));
assert_eq!(ft.field("Int_value").unwrap().unwrap().into_int(), Some(1));
}

#[test]
Expand Down Expand Up @@ -855,9 +858,9 @@ mod tests {
open_flags: GdalOpenFlags::GDAL_OF_UPDATE,
..DatasetOptions::default()
};
let tmp_file = "/tmp/test.s3db";
std::fs::copy(fixture!("three_layer_ds.s3db"), tmp_file).unwrap();
let ds = Dataset::open_ex(tmp_file, ds_options).unwrap();
let tmp_file = TempFixture::empty("test.s3db");
std::fs::copy(fixture!("three_layer_ds.s3db"), &tmp_file).unwrap();
let ds = Dataset::open_ex(&tmp_file, ds_options).unwrap();
let mut layer = ds.layer(0).unwrap();
let fids: Vec<u64> = layer.features().map(|f| f.fid().unwrap()).collect();
let feature = layer.feature(fids[0]).unwrap();
Expand All @@ -866,7 +869,7 @@ mod tests {
layer.set_feature(feature).ok();

// now we check that the field is 1.
let ds = Dataset::open(tmp_file).unwrap();
let ds = Dataset::open(&tmp_file).unwrap();
let layer = ds.layer(0).unwrap();
let feature = layer.feature(fids[0]).unwrap();
let value = feature.field("id").unwrap().unwrap().into_int().unwrap();
Expand Down