Skip to content

Commit

Permalink
deterministic snapshot names with rstest
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Oct 5, 2023
1 parent 2f77a75 commit fce6f12
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/db/to_bin/clinvar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,19 @@ mod test {
use crate::common::open_read_maybe_gz;
use crate::db::to_bin::clinvar::input::Assembly;

macro_rules! set_snapshot_suffix {
($($expr:expr),*) => {
let mut settings = insta::Settings::clone_current();
settings.set_snapshot_suffix(format!($($expr,)*));
let _guard = settings.bind_to_scope();
}
}

#[rstest::rstest]
#[case(Assembly::Grch37)]
#[case(Assembly::Grch38)]
fn run_convert_jsonl_to_protobuf(#[case] assembly: Assembly) -> Result<(), anyhow::Error> {
set_snapshot_suffix!("{:?}", assembly);
let reader = open_read_maybe_gz(
"tests/db/to-bin/varfish-db-downloader/vardbs/clinvar/clinvar-svs.jsonl",
)?;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/db/to_bin/clinvar/mod.rs
assertion_line: 206
expression: records
---
- chrom_no: 6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/db/to_bin/clinvar/mod.rs
assertion_line: 206
expression: records
---
- chrom_no: 6
Expand Down

0 comments on commit fce6f12

Please sign in to comment.