@@ -387,22 +387,11 @@ fn configuration_rule_severity() -> anyhow::Result<()> {
387387 "# ,
388388 ) ?;
389389
390- // Assert that there's an `unresolved-reference` diagnostic (error)
391- // and a `division-by-zero` diagnostic (error).
392- assert_cmd_snapshot ! ( case. command( ) , @r"
390+ // Assert that there's an `unresolved-reference` diagnostic (error).
391+ assert_cmd_snapshot ! ( case. command( ) , @r###"
393392 success: false
394393 exit_code: 1
395394 ----- stdout -----
396- error[division-by-zero]: Cannot divide object of type `Literal[4]` by zero
397- --> test.py:2:5
398- |
399- 2 | y = 4 / 0
400- | ^^^^^
401- 3 |
402- 4 | for a in range(0, int(y)):
403- |
404- info: rule `division-by-zero` is enabled by default
405-
406395 error[unresolved-reference]: Name `prin` used when not defined
407396 --> test.py:7:1
408397 |
@@ -413,17 +402,17 @@ fn configuration_rule_severity() -> anyhow::Result<()> {
413402 |
414403 info: rule `unresolved-reference` is enabled by default
415404
416- Found 2 diagnostics
405+ Found 1 diagnostic
417406
418407 ----- stderr -----
419408 WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
420- " ) ;
409+ "### ) ;
421410
422411 case. write_file (
423412 "pyproject.toml" ,
424413 r#"
425414 [tool.ty.rules]
426- division-by-zero = "warn" # demote to warn
415+ division-by-zero = "warn" # promote to warn
427416 unresolved-reference = "ignore"
428417 "# ,
429418 ) ?;
@@ -468,9 +457,9 @@ fn cli_rule_severity() -> anyhow::Result<()> {
468457 "# ,
469458 ) ?;
470459
471- // Assert that there's an `unresolved-reference` diagnostic (error),
472- // a `division-by-zero` (error) and a unresolved-import (error) diagnostic by default.
473- assert_cmd_snapshot ! ( case. command( ) , @r"
460+ // Assert that there's an `unresolved-reference` diagnostic (error)
461+ // and an unresolved-import (error) diagnostic by default.
462+ assert_cmd_snapshot ! ( case. command( ) , @r### "
474463 success: false
475464 exit_code: 1
476465 ----- stdout -----
@@ -485,18 +474,6 @@ fn cli_rule_severity() -> anyhow::Result<()> {
485474 info: make sure your Python environment is properly configured: https://github.com/astral-sh/ty/blob/main/docs/README.md#python-environment
486475 info: rule `unresolved-import` is enabled by default
487476
488- error[division-by-zero]: Cannot divide object of type `Literal[4]` by zero
489- --> test.py:4:5
490- |
491- 2 | import does_not_exit
492- 3 |
493- 4 | y = 4 / 0
494- | ^^^^^
495- 5 |
496- 6 | for a in range(0, int(y)):
497- |
498- info: rule `division-by-zero` is enabled by default
499-
500477 error[unresolved-reference]: Name `prin` used when not defined
501478 --> test.py:9:1
502479 |
@@ -507,11 +484,11 @@ fn cli_rule_severity() -> anyhow::Result<()> {
507484 |
508485 info: rule `unresolved-reference` is enabled by default
509486
510- Found 3 diagnostics
487+ Found 2 diagnostics
511488
512489 ----- stderr -----
513490 WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
514- " ) ;
491+ "### ) ;
515492
516493 assert_cmd_snapshot ! (
517494 case
@@ -575,22 +552,11 @@ fn cli_rule_severity_precedence() -> anyhow::Result<()> {
575552 "# ,
576553 ) ?;
577554
578- // Assert that there's a `unresolved-reference` diagnostic (error)
579- // and a `division-by-zero` (error) by default.
580- assert_cmd_snapshot ! ( case. command( ) , @r"
555+ // Assert that there's a `unresolved-reference` diagnostic (error) by default.
556+ assert_cmd_snapshot ! ( case. command( ) , @r###"
581557 success: false
582558 exit_code: 1
583559 ----- stdout -----
584- error[division-by-zero]: Cannot divide object of type `Literal[4]` by zero
585- --> test.py:2:5
586- |
587- 2 | y = 4 / 0
588- | ^^^^^
589- 3 |
590- 4 | for a in range(0, int(y)):
591- |
592- info: rule `division-by-zero` is enabled by default
593-
594560 error[unresolved-reference]: Name `prin` used when not defined
595561 --> test.py:7:1
596562 |
@@ -601,11 +567,11 @@ fn cli_rule_severity_precedence() -> anyhow::Result<()> {
601567 |
602568 info: rule `unresolved-reference` is enabled by default
603569
604- Found 2 diagnostics
570+ Found 1 diagnostic
605571
606572 ----- stderr -----
607573 WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
608- " ) ;
574+ "### ) ;
609575
610576 assert_cmd_snapshot ! (
611577 case
@@ -614,7 +580,6 @@ fn cli_rule_severity_precedence() -> anyhow::Result<()> {
614580 . arg( "unresolved-reference" )
615581 . arg( "--warn" )
616582 . arg( "division-by-zero" )
617- // Override the error severity with warning
618583 . arg( "--ignore" )
619584 . arg( "unresolved-reference" ) ,
620585 @r"
@@ -1103,18 +1068,10 @@ fn check_specific_paths() -> anyhow::Result<()> {
11031068
11041069 assert_cmd_snapshot ! (
11051070 case. command( ) ,
1106- @r"
1071+ @r### "
11071072 success: false
11081073 exit_code: 1
11091074 ----- stdout -----
1110- error[division-by-zero]: Cannot divide object of type `Literal[4]` by zero
1111- --> project/main.py:2:5
1112- |
1113- 2 | y = 4 / 0 # error: division-by-zero
1114- | ^^^^^
1115- |
1116- info: rule `division-by-zero` is enabled by default
1117-
11181075 error[unresolved-import]: Cannot resolve imported module `main2`
11191076 --> project/other.py:2:6
11201077 |
@@ -1135,11 +1092,11 @@ fn check_specific_paths() -> anyhow::Result<()> {
11351092 info: make sure your Python environment is properly configured: https://github.com/astral-sh/ty/blob/main/docs/README.md#python-environment
11361093 info: rule `unresolved-import` is enabled by default
11371094
1138- Found 3 diagnostics
1095+ Found 2 diagnostics
11391096
11401097 ----- stderr -----
11411098 WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
1142- "
1099+ "###
11431100 ) ;
11441101
11451102 // Now check only the `tests` and `other.py` files.
0 commit comments