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

Add --ignore-skip flag #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Runt Changelog
==============

Unreleased
-----
- Add `--ignore-skip` to run tests with a `.skip` file

0.4.0
-----

Expand Down
4 changes: 4 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ pub struct Opts {
#[argh(switch, short = 'v')]
pub verbose: bool,

/// also run tests which are normally skipped with .skip files
#[argh(switch)]
pub ignore_skip: bool,

/// filter out the reported test results based on test status
/// ("pass", "fail", "miss") or a regex for the test file path.
/// Applied after running the tests.
Expand Down
5 changes: 3 additions & 2 deletions src/executor/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ impl Executor {
/// completion)
pub fn execute_all(
self,
ignore_skip: bool,
) -> impl stream::Stream<Item = Result<results::Test, RuntError>> {
stream::iter(self.tests.into_iter().map(|test| test.execute_test()))
stream::iter(self.tests.into_iter().map(move |test| test.execute_test(ignore_skip)))
.buffer_unordered(self.max_futures)
}
}
Expand Down Expand Up @@ -176,7 +177,7 @@ impl Context {
opts: &cli::Opts,
) -> Result<i32, errors::RuntError> {
let mut st = Status::new(self.exec.tests.len() as u64);
let mut tasks = self.exec.execute_all();
let mut tasks = self.exec.execute_all(opts.ignore_skip);

// Initial summary printing to give user feedback that runt has started.
st.stream_summary().await?;
Expand Down
4 changes: 2 additions & 2 deletions src/executor/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ impl Test {
/// std library fs::* and command::* so that there is a 1-to-1
/// correspondence between tokio threads and spawned processes.
/// This lets us control the number of parallel running processes.
pub async fn execute_test(self) -> Result<results::Test, RuntError> {
pub async fn execute_test(self, ignore_skip: bool) -> Result<results::Test, RuntError> {
let skip_path = self.skip_file();
if skip_path.exists() {
if skip_path.exists() && !ignore_skip {
return Ok(results::Test {
path: self.path,
expect_path: skip_path,
Expand Down