[ty] Remove 'pre-release software' warning (#20817)

This commit is contained in:
Micha Reiser
2025-10-13 19:50:19 +02:00
committed by GitHub
parent 975891fc90
commit 373fe8a39c
7 changed files with 260 additions and 400 deletions

View File

@@ -26,7 +26,7 @@ fn config_override_python_version() -> anyhow::Result<()> {
),
])?;
assert_cmd_snapshot!(case.command(), @r"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -42,18 +42,16 @@ fn config_override_python_version() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
assert_cmd_snapshot!(case.command().arg("--python-version").arg("3.12"), @r"
assert_cmd_snapshot!(case.command().arg("--python-version").arg("3.12"), @r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -80,7 +78,7 @@ fn config_override_python_platform() -> anyhow::Result<()> {
),
])?;
assert_cmd_snapshot!(case.command(), @r#"
assert_cmd_snapshot!(case.command(), @r###"
success: true
exit_code: 0
----- stdout -----
@@ -96,10 +94,9 @@ fn config_override_python_platform() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
assert_cmd_snapshot!(case.command().arg("--python-platform").arg("all"), @r"
assert_cmd_snapshot!(case.command().arg("--python-platform").arg("all"), @r###"
success: true
exit_code: 0
----- stdout -----
@@ -115,8 +112,7 @@ fn config_override_python_platform() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -139,7 +135,7 @@ fn config_file_annotation_showing_where_python_version_set_typing_error() -> any
),
])?;
assert_cmd_snapshot!(case.command(), @r#"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -162,10 +158,9 @@ fn config_file_annotation_showing_where_python_version_set_typing_error() -> any
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
assert_cmd_snapshot!(case.command().arg("--python-version=3.9"), @r"
assert_cmd_snapshot!(case.command().arg("--python-version=3.9"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -182,8 +177,7 @@ fn config_file_annotation_showing_where_python_version_set_typing_error() -> any
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -201,7 +195,7 @@ fn src_subdirectory_takes_precedence_over_repo_root() -> anyhow::Result<()> {
// If `./src` didn't take priority over `.` here, we would report
// "Module `src.package` has no member `nonexistent_submodule`"
// instead of "Module `package` has no member `nonexistent_submodule`".
assert_cmd_snapshot!(case.command(), @r"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -216,8 +210,7 @@ fn src_subdirectory_takes_precedence_over_repo_root() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -242,7 +235,7 @@ fn python_version_inferred_from_system_installation() -> anyhow::Result<()> {
("test.py", "aiter"),
])?;
assert_cmd_snapshot!(cpython_case.command().arg("--python").arg("pythons/Python3.8/bin/python"), @r"
assert_cmd_snapshot!(cpython_case.command().arg("--python").arg("pythons/Python3.8/bin/python"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -261,8 +254,7 @@ fn python_version_inferred_from_system_installation() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
let pypy_case = CliTest::with_files([
("pythons/pypy3.8/bin/python", ""),
@@ -270,7 +262,7 @@ fn python_version_inferred_from_system_installation() -> anyhow::Result<()> {
("test.py", "aiter"),
])?;
assert_cmd_snapshot!(pypy_case.command().arg("--python").arg("pythons/pypy3.8/bin/python"), @r"
assert_cmd_snapshot!(pypy_case.command().arg("--python").arg("pythons/pypy3.8/bin/python"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -289,8 +281,7 @@ fn python_version_inferred_from_system_installation() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
let free_threaded_case = CliTest::with_files([
("pythons/Python3.13t/bin/python", ""),
@@ -301,7 +292,7 @@ fn python_version_inferred_from_system_installation() -> anyhow::Result<()> {
("test.py", "import string.templatelib"),
])?;
assert_cmd_snapshot!(free_threaded_case.command().arg("--python").arg("pythons/Python3.13t/bin/python"), @r"
assert_cmd_snapshot!(free_threaded_case.command().arg("--python").arg("pythons/Python3.13t/bin/python"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -320,8 +311,7 @@ fn python_version_inferred_from_system_installation() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -356,7 +346,7 @@ import bar",
"strange-venv-location/bin/python",
)?;
assert_cmd_snapshot!(case.command().arg("--python").arg("strange-venv-location/bin/python"), @r"
assert_cmd_snapshot!(case.command().arg("--python").arg("strange-venv-location/bin/python"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -377,8 +367,7 @@ import bar",
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -406,7 +395,7 @@ fn lib64_site_packages_directory_on_unix() -> anyhow::Result<()> {
("test.py", "import foo, bar, baz"),
])?;
assert_cmd_snapshot!(case.command().arg("--python").arg(".venv"), @r"
assert_cmd_snapshot!(case.command().arg("--python").arg(".venv"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -427,8 +416,7 @@ fn lib64_site_packages_directory_on_unix() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -463,7 +451,7 @@ fn pyvenv_cfg_file_annotation_showing_where_python_version_set() -> anyhow::Resu
("test.py", "aiter"),
])?;
assert_cmd_snapshot!(case.command(), @r"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -487,8 +475,7 @@ fn pyvenv_cfg_file_annotation_showing_where_python_version_set() -> anyhow::Resu
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -523,7 +510,7 @@ fn pyvenv_cfg_file_annotation_no_trailing_newline() -> anyhow::Result<()> {
("test.py", "aiter"),
])?;
assert_cmd_snapshot!(case.command(), @r"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -546,8 +533,7 @@ fn pyvenv_cfg_file_annotation_no_trailing_newline() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -574,7 +560,7 @@ fn config_file_annotation_showing_where_python_version_set_syntax_error() -> any
),
])?;
assert_cmd_snapshot!(case.command(), @r#"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -597,10 +583,9 @@ fn config_file_annotation_showing_where_python_version_set_syntax_error() -> any
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
assert_cmd_snapshot!(case.command().arg("--python-version=3.9"), @r"
assert_cmd_snapshot!(case.command().arg("--python-version=3.9"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -617,8 +602,7 @@ fn config_file_annotation_showing_where_python_version_set_syntax_error() -> any
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -648,51 +632,47 @@ fn python_cli_argument_virtual_environment() -> anyhow::Result<()> {
])?;
// Passing a path to the installation works
assert_cmd_snapshot!(case.command().arg("--python").arg("my-venv"), @r"
assert_cmd_snapshot!(case.command().arg("--python").arg("my-venv"), @r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// And so does passing a path to the executable inside the installation
assert_cmd_snapshot!(case.command().arg("--python").arg(path_to_executable), @r"
assert_cmd_snapshot!(case.command().arg("--python").arg(path_to_executable), @r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// But random other paths inside the installation are rejected
assert_cmd_snapshot!(case.command().arg("--python").arg(other_venv_path), @r"
assert_cmd_snapshot!(case.command().arg("--python").arg(other_venv_path), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
ty failed
Cause: Invalid `--python` argument `<temp_dir>/my-venv/foo/some_other_file.txt`: does not point to a Python executable or a directory on disk
");
"###);
// And so are paths that do not exist on disk
assert_cmd_snapshot!(case.command().arg("--python").arg("not-a-directory-or-executable"), @r"
assert_cmd_snapshot!(case.command().arg("--python").arg("not-a-directory-or-executable"), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
ty failed
Cause: Invalid `--python` argument `<temp_dir>/not-a-directory-or-executable`: does not point to a Python executable or a directory on disk
Cause: No such file or directory (os error 2)
");
"###);
Ok(())
}
@@ -719,26 +699,24 @@ fn python_cli_argument_system_installation() -> anyhow::Result<()> {
])?;
// Passing a path to the installation works
assert_cmd_snapshot!(case.command().arg("--python").arg("Python3.11"), @r"
assert_cmd_snapshot!(case.command().arg("--python").arg("Python3.11"), @r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// And so does passing a path to the executable inside the installation
assert_cmd_snapshot!(case.command().arg("--python").arg(path_to_executable), @r"
assert_cmd_snapshot!(case.command().arg("--python").arg(path_to_executable), @r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -764,13 +742,12 @@ fn config_file_broken_python_setting() -> anyhow::Result<()> {
("test.py", ""),
])?;
assert_cmd_snapshot!(case.command(), @r#"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
ty failed
Cause: Invalid `environment.python` setting
@@ -783,7 +760,7 @@ fn config_file_broken_python_setting() -> anyhow::Result<()> {
|
Cause: No such file or directory (os error 2)
"#);
"###);
Ok(())
}
@@ -802,13 +779,12 @@ fn config_file_python_setting_directory_with_no_site_packages() -> anyhow::Resul
("test.py", ""),
])?;
assert_cmd_snapshot!(case.command(), @r#"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
ty failed
Cause: Failed to discover the site-packages directory
Cause: Invalid `environment.python` setting
@@ -820,7 +796,7 @@ fn config_file_python_setting_directory_with_no_site_packages() -> anyhow::Resul
3 | python = "directory-but-no-site-packages"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Could not find a `site-packages` directory for this Python installation/executable
|
"#);
"###);
Ok(())
}
@@ -841,13 +817,12 @@ fn unix_system_installation_with_no_lib_directory() -> anyhow::Result<()> {
("test.py", ""),
])?;
assert_cmd_snapshot!(case.command(), @r#"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
ty failed
Cause: Failed to discover the site-packages directory
Cause: Failed to iterate over the contents of the `lib`/`lib64` directories of the Python installation
@@ -859,7 +834,7 @@ fn unix_system_installation_with_no_lib_directory() -> anyhow::Result<()> {
3 | python = "directory-but-no-site-packages"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
"#);
"###);
Ok(())
}
@@ -888,7 +863,7 @@ fn defaults_to_a_new_python_version() -> anyhow::Result<()> {
),
])?;
assert_cmd_snapshot!(case.command(), @r"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -905,8 +880,7 @@ fn defaults_to_a_new_python_version() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// Use default (which should be latest supported)
let case = CliTest::with_files([
@@ -927,15 +901,14 @@ fn defaults_to_a_new_python_version() -> anyhow::Result<()> {
),
])?;
assert_cmd_snapshot!(case.command(), @r"
assert_cmd_snapshot!(case.command(), @r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -1089,7 +1062,7 @@ home = ./
// Run with nothing set, should find the working venv
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project")), @r"
.current_dir(case.root().join("project")), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1107,13 +1080,12 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// Run with VIRTUAL_ENV set, should find the active venv
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project"))
.env("VIRTUAL_ENV", case.root().join("myvenv")), @r"
.env("VIRTUAL_ENV", case.root().join("myvenv")), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1130,13 +1102,12 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// run with CONDA_PREFIX set, should find the child conda
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project"))
.env("CONDA_PREFIX", case.root().join("conda/envs/conda-env")), @r"
.env("CONDA_PREFIX", case.root().join("conda/envs/conda-env")), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1154,14 +1125,13 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// run with CONDA_PREFIX and CONDA_DEFAULT_ENV set (unequal), should find working venv
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project"))
.env("CONDA_PREFIX", case.root().join("conda"))
.env("CONDA_DEFAULT_ENV", "base"), @r"
.env("CONDA_DEFAULT_ENV", "base"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1179,8 +1149,7 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// run with CONDA_PREFIX and CONDA_DEFAULT_ENV (unequal) and VIRTUAL_ENV set,
// should find child active venv
@@ -1188,7 +1157,7 @@ home = ./
.current_dir(case.root().join("project"))
.env("CONDA_PREFIX", case.root().join("conda"))
.env("CONDA_DEFAULT_ENV", "base")
.env("VIRTUAL_ENV", case.root().join("myvenv")), @r"
.env("VIRTUAL_ENV", case.root().join("myvenv")), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1205,14 +1174,13 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// run with CONDA_PREFIX and CONDA_DEFAULT_ENV (equal!) set, should find ChildConda
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project"))
.env("CONDA_PREFIX", case.root().join("conda/envs/conda-env"))
.env("CONDA_DEFAULT_ENV", "conda-env"), @r"
.env("CONDA_DEFAULT_ENV", "conda-env"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1230,14 +1198,13 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// run with _CONDA_ROOT and CONDA_PREFIX (unequal!) set, should find ChildConda
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project"))
.env("CONDA_PREFIX", case.root().join("conda/envs/conda-env"))
.env("_CONDA_ROOT", "conda"), @r"
.env("_CONDA_ROOT", "conda"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1255,14 +1222,13 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// run with _CONDA_ROOT and CONDA_PREFIX (equal!) set, should find BaseConda
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project"))
.env("CONDA_PREFIX", case.root().join("conda"))
.env("_CONDA_ROOT", "conda"), @r"
.env("_CONDA_ROOT", "conda"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1279,8 +1245,7 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -1353,7 +1318,7 @@ home = ./
// Run with nothing set, should fail to find anything
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project")), @r"
.current_dir(case.root().join("project")), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1418,13 +1383,12 @@ home = ./
Found 4 diagnostics
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// Run with VIRTUAL_ENV set, should find the active venv
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project"))
.env("VIRTUAL_ENV", case.root().join("myvenv")), @r"
.env("VIRTUAL_ENV", case.root().join("myvenv")), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1441,13 +1405,12 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// run with CONDA_PREFIX set, should find the child conda
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project"))
.env("CONDA_PREFIX", case.root().join("conda/envs/conda-env")), @r"
.env("CONDA_PREFIX", case.root().join("conda/envs/conda-env")), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1465,14 +1428,13 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// run with CONDA_PREFIX and CONDA_DEFAULT_ENV set (unequal), should find base conda
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project"))
.env("CONDA_PREFIX", case.root().join("conda"))
.env("CONDA_DEFAULT_ENV", "base"), @r"
.env("CONDA_DEFAULT_ENV", "base"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1489,8 +1451,7 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// run with CONDA_PREFIX and CONDA_DEFAULT_ENV (unequal) and VIRTUAL_ENV set,
// should find child active venv
@@ -1498,7 +1459,7 @@ home = ./
.current_dir(case.root().join("project"))
.env("CONDA_PREFIX", case.root().join("conda"))
.env("CONDA_DEFAULT_ENV", "base")
.env("VIRTUAL_ENV", case.root().join("myvenv")), @r"
.env("VIRTUAL_ENV", case.root().join("myvenv")), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1515,14 +1476,13 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// run with CONDA_PREFIX and CONDA_DEFAULT_ENV (unequal!) set, should find base conda
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project"))
.env("CONDA_PREFIX", case.root().join("conda"))
.env("CONDA_DEFAULT_ENV", "base"), @r"
.env("CONDA_DEFAULT_ENV", "base"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1539,14 +1499,13 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// run with _CONDA_ROOT and CONDA_PREFIX (unequal!) set, should find ChildConda
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project"))
.env("CONDA_PREFIX", case.root().join("conda/envs/conda-env"))
.env("_CONDA_ROOT", "conda"), @r"
.env("_CONDA_ROOT", "conda"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1564,14 +1523,13 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
// run with _CONDA_ROOT and CONDA_PREFIX (equal!) set, should find BaseConda
assert_cmd_snapshot!(case.command()
.current_dir(case.root().join("project"))
.env("CONDA_PREFIX", case.root().join("conda"))
.env("_CONDA_ROOT", "conda"), @r"
.env("_CONDA_ROOT", "conda"), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1588,8 +1546,7 @@ home = ./
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -1607,7 +1564,7 @@ fn src_root_deprecation_warning() -> anyhow::Result<()> {
("src/test.py", ""),
])?;
assert_cmd_snapshot!(case.command(), @r#"
assert_cmd_snapshot!(case.command(), @r###"
success: true
exit_code: 0
----- stdout -----
@@ -1622,8 +1579,7 @@ fn src_root_deprecation_warning() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
Ok(())
}
@@ -1644,7 +1600,7 @@ fn src_root_deprecation_warning_with_environment_root() -> anyhow::Result<()> {
("app/test.py", ""),
])?;
assert_cmd_snapshot!(case.command(), @r#"
assert_cmd_snapshot!(case.command(), @r###"
success: true
exit_code: 0
----- stdout -----
@@ -1662,8 +1618,7 @@ fn src_root_deprecation_warning_with_environment_root() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
Ok(())
}
@@ -1690,7 +1645,7 @@ fn environment_root_takes_precedence_over_src_root() -> anyhow::Result<()> {
// The test should pass because environment.root points to ./app where my_module.py exists
// If src.root took precedence, it would fail because my_module.py doesn't exist in ./src
assert_cmd_snapshot!(case.command(), @r#"
assert_cmd_snapshot!(case.command(), @r###"
success: true
exit_code: 0
----- stdout -----
@@ -1708,8 +1663,7 @@ fn environment_root_takes_precedence_over_src_root() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
Ok(())
}
@@ -1730,15 +1684,14 @@ fn default_root_src_layout() -> anyhow::Result<()> {
),
])?;
assert_cmd_snapshot!(case.command(), @r"
assert_cmd_snapshot!(case.command(), @r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -1766,15 +1719,14 @@ fn default_root_project_name_folder() -> anyhow::Result<()> {
),
])?;
assert_cmd_snapshot!(case.command(), @r"
assert_cmd_snapshot!(case.command(), @r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -1795,15 +1747,14 @@ fn default_root_flat_layout() -> anyhow::Result<()> {
),
])?;
assert_cmd_snapshot!(case.command(), @r"
assert_cmd_snapshot!(case.command(), @r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -1824,15 +1775,14 @@ fn default_root_tests_folder() -> anyhow::Result<()> {
),
])?;
assert_cmd_snapshot!(case.command(), @r"
assert_cmd_snapshot!(case.command(), @r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -1855,7 +1805,7 @@ fn default_root_tests_package() -> anyhow::Result<()> {
),
])?;
assert_cmd_snapshot!(case.command(), @r#"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1878,8 +1828,7 @@ fn default_root_tests_package() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
Ok(())
}
@@ -1900,15 +1849,14 @@ fn default_root_python_folder() -> anyhow::Result<()> {
),
])?;
assert_cmd_snapshot!(case.command(), @r"
assert_cmd_snapshot!(case.command(), @r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
");
"###);
Ok(())
}
@@ -1931,7 +1879,7 @@ fn default_root_python_package() -> anyhow::Result<()> {
),
])?;
assert_cmd_snapshot!(case.command(), @r#"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -1954,8 +1902,7 @@ fn default_root_python_package() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
Ok(())
}
@@ -1978,7 +1925,7 @@ fn default_root_python_package_pyi() -> anyhow::Result<()> {
),
])?;
assert_cmd_snapshot!(case.command(), @r#"
assert_cmd_snapshot!(case.command(), @r###"
success: false
exit_code: 1
----- stdout -----
@@ -2001,8 +1948,7 @@ fn default_root_python_package_pyi() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
Ok(())
}
@@ -2021,7 +1967,7 @@ fn pythonpath_is_respected() -> anyhow::Result<()> {
])?;
assert_cmd_snapshot!(case.command(),
@r#"
@r###"
success: false
exit_code: 1
----- stdout -----
@@ -2042,20 +1988,18 @@ fn pythonpath_is_respected() -> anyhow::Result<()> {
Found 1 diagnostic
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
assert_cmd_snapshot!(case.command()
.env("PYTHONPATH", case.root().join("baz-dir")),
@r#"
@r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
Ok(())
}
@@ -2078,7 +2022,7 @@ fn pythonpath_multiple_dirs_is_respected() -> anyhow::Result<()> {
])?;
assert_cmd_snapshot!(case.command(),
@r#"
@r###"
success: false
exit_code: 1
----- stdout -----
@@ -2115,22 +2059,20 @@ fn pythonpath_multiple_dirs_is_respected() -> anyhow::Result<()> {
Found 2 diagnostics
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
let pythonpath =
std::env::join_paths([case.root().join("baz-dir"), case.root().join("foo-dir")])?;
assert_cmd_snapshot!(case.command()
.env("PYTHONPATH", pythonpath),
@r#"
@r###"
success: true
exit_code: 0
----- stdout -----
All checks passed!
----- stderr -----
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
"#);
"###);
Ok(())
}