<commit_before>use std::env;

use cargo::core::dependency::Kind;
use cargo::core::{enable_nightly_features, Dependency};
use cargo::util::Config;

use crate::support::project;
use crate::support::registry::Package;
use crate::support::resolver::{
    assert_contains, assert_same, dep, dep_kind, dep_loc, dep_req, loc_names, names, pkg, pkg_dep,
    pkg_id, pkg_loc, registry, registry_strategy, resolve, resolve_and_validated,
    resolve_with_config, PrettyPrintRegistry, ToDep, ToPkgId,
};

use proptest::collection::vec;
use proptest::prelude::*;
use proptest::*;

/// NOTE: proptest is a form of fuzz testing. It generates random input and makes shore that
/// certain universal truths are upheld. Therefore, it can pass when there is a problem,
/// but if it fails then there really is something wrong. When testing something as
/// complicated as the resolver, the problems can be very subtle and hard to generate.
/// We have had a history of these tests only failing on PRs long after a bug is introduced.
/// If you have one of these test fail please report it on #6258,
/// and if you did not change the resolver then feel free to retry without concern.
proptest! {
    #![proptest_config(ProptestConfig {
        // Note that this is a little low in terms of cases we'd like to test,
        // but this number affects how long this function takes. It can be
        // increased locally to execute more tests and try to find more bugs,
        // but for now it's semi-low to run in a small-ish amount of time on CI
        // and locally.
        cases: 256,
        max_shrink_iters:
            if env::var("CI").is_ok() {
                // This attempts to make sure that CI will fail fast,
                0
            } else {
                // but that local builds will give a small clear test case.
                ProptestConfig::default().max_shrink_iters
            },
        .. ProptestConfig::default()
    })]

    /// NOTE: if you think this test has failed spuriously see the note at the top of this macro.
    #[test]
    fn passes_validation(
        PrettyPrintRegistry(input) in registry_strategy(50, 20, 60)
    )  {<commit_msg>Don't shrink if not tty<commit_after>use std::env;

use cargo::core::dependency::Kind;
use cargo::core::{enable_nightly_features, Dependency};
use cargo::util::Config;

use crate::support::project;
use crate::support::registry::Package;
use crate::support::resolver::{
    assert_contains, assert_same, dep, dep_kind, dep_loc, dep_req, loc_names, names, pkg, pkg_dep,
    pkg_id, pkg_loc, registry, registry_strategy, resolve, resolve_and_validated,
    resolve_with_config, PrettyPrintRegistry, ToDep, ToPkgId,
};

use proptest::collection::vec;
use proptest::prelude::*;
use proptest::*;

/// NOTE: proptest is a form of fuzz testing. It generates random input and makes shore that
/// certain universal truths are upheld. Therefore, it can pass when there is a problem,
/// but if it fails then there really is something wrong. When testing something as
/// complicated as the resolver, the problems can be very subtle and hard to generate.
/// We have had a history of these tests only failing on PRs long after a bug is introduced.
/// If you have one of these test fail please report it on #6258,
/// and if you did not change the resolver then feel free to retry without concern.
proptest! {
    #![proptest_config(ProptestConfig {
        // Note that this is a little low in terms of cases we'd like to test,
        // but this number affects how long this function takes. It can be
        // increased locally to execute more tests and try to find more bugs,
        // but for now it's semi-low to run in a small-ish amount of time on CI
        // and locally.
        cases: 256,
        max_shrink_iters:
            if env::var("CI").is_ok() || !atty::is(atty::Stream::Stderr) {
                // This attempts to make sure that CI will fail fast,
                0
            } else {
                // but that local builds will give a small clear test case.
                ProptestConfig::default().max_shrink_iters
            },
        .. ProptestConfig::default()
    })]

    /// NOTE: if you think this test has failed spuriously see the note at the top of this macro.
    #[test]
    fn passes_validation(
        PrettyPrintRegistry(input) in registry_strategy(50, 20, 60)
    )  {
{'fraction_non_alphanumeric': 0.09130335539831089, 'fraction_numerical': 0.006391234877881762, 'mean_word_length': 2.9441944194419443, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4793411', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1207, 'n_words': 523}