MCPcopy Create free account
hub / github.com/astral-sh/ruff / config_override_python_platform

Function config_override_python_platform

crates/ty/tests/cli/python_environment.rs:64–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62/// Same as above, but for the Python platform.
63#[test]
64fn config_override_python_platform() -> anyhow::Result<()> {
65 let case = CliTest::with_files([
66 (
67 "pyproject.toml",
68 r#"
69 [tool.ty.environment]
70 python-platform = "linux"
71 "#,
72 ),
73 (
74 "test.py",
75 r#"
76 import sys
77 from typing_extensions import reveal_type
78
79 reveal_type(sys.platform)
80 "#,
81 ),
82 ])?;
83
84 assert_cmd_snapshot!(case.command(), @r#"
85 success: true
86 exit_code: 0
87 ----- stdout -----
88 info[revealed-type]: Revealed type
89 --> test.py:5:13
90 |
91 5 | reveal_type(sys.platform)
92 | ^^^^^^^^^^^^ `Literal["linux"]`
93
94 Found 1 diagnostic
95
96 ----- stderr -----
97 "#);
98
99 assert_cmd_snapshot!(case.command().arg("--python-platform").arg("all"), @"
100 success: true
101 exit_code: 0
102 ----- stdout -----
103 info[revealed-type]: Revealed type
104 --> test.py:5:13
105 |
106 5 | reveal_type(sys.platform)
107 | ^^^^^^^^^^^^ `LiteralString`
108
109 Found 1 diagnostic
110
111 ----- stderr -----
112 ");
113
114 Ok(())
115}
116
117#[test]
118fn config_file_annotation_showing_where_python_version_set_typing_error() -> anyhow::Result<()> {

Callers

nothing calls this directly

Calls 2

with_filesFunction · 0.85
OkClass · 0.85

Tested by

no test coverage detected