Skip to content

Commit 7131b9c

Browse files
committed
Disable compression snapshot tests on windows and use persist instead of rename in config save
1 parent 22cdb58 commit 7131b9c

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

crates/tmc-langs-cli/tests/integration.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ fn clean() {
138138
}
139139

140140
#[test]
141+
#[cfg(not(target_os = "windows"))] // hash differs on windows
141142
fn compress_project_tar() {
142143
test(|exercise| {
143144
let target = NamedTempFile::new().unwrap();
@@ -164,6 +165,7 @@ fn compress_project_tar() {
164165
}
165166

166167
#[test]
168+
#[cfg(not(target_os = "windows"))] // hash differs on windows
167169
fn compress_project_zip() {
168170
test(|exercise| {
169171
let target = NamedTempFile::new().unwrap();
@@ -191,6 +193,7 @@ fn compress_project_zip() {
191193
}
192194

193195
#[test]
196+
#[cfg(not(target_os = "windows"))] // hash differs on windows
194197
fn compress_project_zstd() {
195198
test(|exercise| {
196199
let target = NamedTempFile::new().unwrap();

crates/tmc-langs-util/src/file_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::{
1717
ops::{Deref, DerefMut},
1818
path::{Path, PathBuf},
1919
};
20-
use tempfile::NamedTempFile;
20+
use tempfile::{NamedTempFile, TempDir};
2121
use walkdir::WalkDir;
2222

2323
/// Convenience macro for locking a path.

crates/tmc-langs/src/config/tmc_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl TmcConfig {
155155
file_util::write_to_file(toml, temp_file.path())?;
156156

157157
log::debug!("Moving new config over old one");
158-
file_util::rename(temp_file.path(), path)?;
158+
temp_file.persist(path)?;
159159
Ok(())
160160
}
161161

crates/tmc-langs/src/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ pub enum LangsError {
124124
Hmac(#[from] hmac::digest::InvalidLength),
125125
#[error(transparent)]
126126
TestMyCodeClient(#[from] tmc_testmycode_client::TestMyCodeClientError),
127+
#[error(transparent)]
128+
PersistTempFile(#[from] tempfile::PersistError),
127129
}
128130

129131
/// Error validating TMC params values.

0 commit comments

Comments
 (0)