Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Described how to run part of the tests (#762)
Browse files Browse the repository at this point in the history
* Described running tests.

* Removed test
  • Loading branch information
jorgecarleitao authored Jan 13, 2022
1 parent 1c6e8bd commit 276d670
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 51 deletions.
22 changes: 22 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ This crate follows the standard for developing a Rust library via `cargo`.
The CI is our "ground truth" over the state of the library. Check out the different parts of
the CI to understand how to test the different parts of this library locally.

## Testing

The simplest way to test the crate is to run

```bash
cargo test
```

This runs the tests of the crate without features. To run all features, use

```bash
cargo test --features full
```

during development of particular parts of the crate, it is usually faster
to reduce the feature set - the tests are gated to only the relevant tests
of that feature set. For example, if improving JSON, you can use

```bash
cargo test --features io_json
```

## Merging

We currently do not have maintaince versions and thus only PR and merge to `main`.
Expand Down
51 changes: 0 additions & 51 deletions src/io/parquet/read/schema/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,54 +83,3 @@ fn parse_key_value_metadata(
None => None,
}
}

#[cfg(test)]
mod tests {
use std::fs::File;

use parquet2::read::read_metadata;

use crate::datatypes::Schema;
use crate::error::Result;

use super::read_schema_from_metadata;

fn read_schema(path: &str) -> Result<Option<Schema>> {
let mut file = File::open(path).unwrap();

let metadata = read_metadata(&mut file)?;
let keys = metadata.key_value_metadata();
read_schema_from_metadata(keys)
}

#[test]
fn test_basic() -> Result<()> {
if std::env::var("ARROW2_IGNORE_PARQUET").is_ok() {
return Ok(());
}
let schema = read_schema("fixtures/pyarrow3/v1/basic_nullable_10.parquet")?;
let names = schema
.unwrap()
.fields
.iter()
.map(|x| x.name.clone())
.collect::<Vec<_>>();
assert_eq!(
names,
vec![
"int64",
"float64",
"string",
"bool",
"date",
"uint32",
"string_large",
"decimal_9",
"decimal_18",
"decimal_26",
"timestamp_us"
]
);
Ok(())
}
}

0 comments on commit 276d670

Please sign in to comment.