houseabsolute / precious

One code quality tool to rule them all
Apache License 2.0
81 stars 4 forks source link

basepaths::tests::git_staged_mode_merge_stash is failing locally #14

Closed oalders closed 2 years ago

oalders commented 2 years ago

I'm trying to run this locally on macOS. My apologies if I'm missing something completely obvious.

$ rustc --version
rustc 1.55.0 (c8dfcfe04 2021-09-06)
$ cargo --version
cargo 1.55.0 (32da73ab1 2021-08-23)
$ RUST_BACKTRACE=1 cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.16s
     Running unittests (target/debug/deps/precious-c4bb563cfbed27c2)

running 36 tests
test basepaths::tests::cli_mode ... ok
test basepaths::tests::all_mode ... ok
test basepaths::tests::cli_mode_given_dir_with_excluded_files ... ok
test basepaths::tests::all_mode_with_gitignore ... ok
test basepaths::tests::cli_mode_given_files_with_excluded_files ... ok
test basepaths::tests::cli_mode_given_files_with_nonexistent_path ... ok
test basepaths::tests::files_to_paths ... ok
test basepaths::tests::git_modified_mode_empty ... ok
test basepaths::tests::git_staged_mode_empty ... ok
test basepaths::tests::git_modified_mode_with_changes ... ok
test basepaths::tests::git_modified_mode_with_excluded_files ... ok
test basepaths::tests::git_staged_mode_merge_stash ... FAILED
test command::tests::command_string ... ok
test command::tests::executable_does_not_exist ... ok
test command::tests::run_command ... ok
test command::tests::run_command_in_dir ... ok
test filter::tests::command_for_path ... ok
test basepaths::tests::git_staged_mode_stashes_unindexed ... ok
test basepaths::tests::git_staged_mode_with_changes ... ok
test filter::tests::should_process_path ... ok
test filter::tests::should_process_path_run_mode_dirs ... ok
test filter::tests::should_process_path_run_mode_root ... ok
test path_matcher::tests::path_matches ... ok
test precious::tests::new ... ok
test precious::tests::new_with_ascii_flag ... ok
test precious::tests::new_with_config_path ... ok
test filter::tests::require_path_type_dir ... ok
test precious::tests::test_format_duration ... ok
test basepaths::tests::git_staged_mode_with_excluded_files ... ok
test filter::tests::require_path_type_file ... ok
test precious::tests::test_basepaths_uses_cwd ... ok
test precious::tests::test_lint_fails ... ok
test precious::tests::test_lint_succeeds ... ok
test precious::tests::test_set_root_prefers_config_file ... ok
test precious::tests::test_tidy_fails ... ok
test precious::tests::test_tidy_succeeds ... ok

failures:

---- basepaths::tests::git_staged_mode_merge_stash stdout ----
Error: Failed to execute command `git checkout --quiet master`

Caused by:
    Got unexpected exit code 1 from `git checkout --quiet master`. Stderr was error: pathspec 'master' did not match any file(s) known to git

thread 'basepaths::tests::git_staged_mode_merge_stash' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`: the test returned a termination value with a non-zero status code (1) which indicates a failure', /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/test/src/lib.rs:194:5
stack backtrace:
   0: rust_begin_unwind
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:92:14
   2: core::panicking::assert_failed_inner
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:154:23
   3: core::panicking::assert_failed
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:117:5
   4: test::assert_test_result
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/test/src/lib.rs:194:5
   5: precious::basepaths::tests::git_staged_mode_merge_stash::{{closure}}
             at ./src/basepaths.rs:555:5
   6: core::ops::function::FnOnce::call_once
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:227:5
   7: core::ops::function::FnOnce::call_once
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

failures:
    basepaths::tests::git_staged_mode_merge_stash

test result: FAILED. 35 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.09s

error: test failed, to rerun pass '--bin precious'
autarch commented 2 years ago

I'm guessing that your default branch is main now? The tests probably need to explicitly set the default branch to master.

Cheers,

Dave Rolsky http://blog.urth.org https://github.com/autarch

On Tue, Oct 5, 2021 at 1:30 PM Olaf Alders @.***> wrote:

I'm trying to run this locally on macOS. My apologies if I'm missing something completely obvious.

$ rustc --version rustc 1.55.0 (c8dfcfe04 2021-09-06) $ cargo --version cargo 1.55.0 (32da73ab1 2021-08-23)

$ RUST_BACKTRACE=1 cargo test Finished test [unoptimized + debuginfo] target(s) in 0.16s Running unittests (target/debug/deps/precious-c4bb563cfbed27c2)

running 36 tests test basepaths::tests::cli_mode ... ok test basepaths::tests::all_mode ... ok test basepaths::tests::cli_mode_given_dir_with_excluded_files ... ok test basepaths::tests::all_mode_with_gitignore ... ok test basepaths::tests::cli_mode_given_files_with_excluded_files ... ok test basepaths::tests::cli_mode_given_files_with_nonexistent_path ... ok test basepaths::tests::files_to_paths ... ok test basepaths::tests::git_modified_mode_empty ... ok test basepaths::tests::git_staged_mode_empty ... ok test basepaths::tests::git_modified_mode_with_changes ... ok test basepaths::tests::git_modified_mode_with_excluded_files ... ok test basepaths::tests::git_staged_mode_merge_stash ... FAILED test command::tests::command_string ... ok test command::tests::executable_does_not_exist ... ok test command::tests::run_command ... ok test command::tests::run_command_in_dir ... ok test filter::tests::command_for_path ... ok test basepaths::tests::git_staged_mode_stashes_unindexed ... ok test basepaths::tests::git_staged_mode_with_changes ... ok test filter::tests::should_process_path ... ok test filter::tests::should_process_path_run_mode_dirs ... ok test filter::tests::should_process_path_run_mode_root ... ok test path_matcher::tests::path_matches ... ok test precious::tests::new ... ok test precious::tests::new_with_ascii_flag ... ok test precious::tests::new_with_config_path ... ok test filter::tests::require_path_type_dir ... ok test precious::tests::test_format_duration ... ok test basepaths::tests::git_staged_mode_with_excluded_files ... ok test filter::tests::require_path_type_file ... ok test precious::tests::test_basepaths_uses_cwd ... ok test precious::tests::test_lint_fails ... ok test precious::tests::test_lint_succeeds ... ok test precious::tests::test_set_root_prefers_config_file ... ok test precious::tests::test_tidy_fails ... ok test precious::tests::test_tidy_succeeds ... ok

failures:

---- basepaths::tests::git_staged_mode_merge_stash stdout ---- Error: Failed to execute command git checkout --quiet master

Caused by: Got unexpected exit code 1 from git checkout --quiet master. Stderr was error: pathspec 'master' did not match any file(s) known to git

thread 'basepaths::tests::git_staged_mode_merge_stash' panicked at 'assertion failed: (left == right) left: 1, right: 0: the test returned a termination value with a non-zero status code (1) which indicates a failure', /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/test/src/lib.rs:194:5 stack backtrace: 0: rust_begin_unwind at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:515:5 1: core::panicking::panic_fmt at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:92:14 2: core::panicking::assert_failed_inner at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:154:23 3: core::panicking::assert_failed at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:117:5 4: test::assert_test_result at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/test/src/lib.rs:194:5 5: precious::basepaths::tests::git_staged_mode_merge_stash::{{closure}} at ./src/basepaths.rs:555:5 6: core::ops::function::FnOnce::call_once at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:227:5 7: core::ops::function::FnOnce::call_once at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:227:5 note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

failures: basepaths::tests::git_staged_mode_merge_stash

test result: FAILED. 35 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.09s

error: test failed, to rerun pass '--bin precious'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/houseabsolute/precious/issues/14, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMMKKX55O4YNGTS3HPLW3UFM727ANCNFSM5FMKMNEQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

oalders commented 2 years ago

Ah, ok. I'll look into that. Thanks!

autarch commented 2 years ago

Ok, weird. I already have something in the testhelper module which should be setting the default branch name to master. So I'm quite confused about this failure.

autarch commented 2 years ago

And looking more carefully, I see that I only do this in CI.

I think what I should do instead is simply set the initial branch when running git init. I will try that and see how that works in CI.

autarch commented 2 years ago

Should be fixed in v0.1.2.

oalders commented 2 years ago

It's fixed. Thanks! I hope you're enjoying some down time. 😄