Skip to content

Don't fetch block numbers nor check rpc version for ignored tests when no --ignored nor --include-ignored flag is specified #1637

@piotmag769

Description

@piotmag769

Which components does the task require to be changed? (think hard pls)

snforge

Description

Currently when no --ignored or --include-ignored flag is passed we let tests marked with #[ignore] pass the filtering here

cases = match self.ignored_filter {
// if NotIgnored (default) we filter ignored tests later and display them as ignored
IgnoredFilter::All | IgnoredFilter::NotIgnored => cases,
IgnoredFilter::Ignored => cases.into_iter().filter(|tc| tc.ignored).collect(),
};

let test_crates = test_crates
.into_iter()
.map(|tc| tests_filter.filter_tests(tc))
.collect::<Result<Vec<CompiledTestCrateRaw>>>()?;

to later print tests as ignored (matches cargo behaviour).

This makes us collect block numbers and check rpc version for tests that won't be executed (in case they are fork tests)

let compiled_test_crate =
to_runnable(compiled_test_crate, fork_targets, block_number_map).await?;

Additionally,

impl TestCaseFilter for TestsFilter {
fn should_be_run(&self, test_case: &TestCaseRunnable) -> bool {
match self.ignored_filter {
IgnoredFilter::All => true,
IgnoredFilter::Ignored => test_case.ignored,
IgnoredFilter::NotIgnored => !test_case.ignored,
}
}
}
should be changed to:

impl TestCaseFilter for TestsFilter {
    fn should_be_run(&self, test_case: &TestCaseRunnable) -> bool {
        match self.ignored_filter {
            IgnoredFilter::All => true,
            IgnoredFilter::Ignored => {
                assert!(test_case.ignored); // we filter all not ignored test before
                true
            }
            IgnoredFilter::NotIgnored => !test_case.ignored,
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions