Skip to content

Commit 9a21598

Browse files
authored
Fixed two bugs in the conformance test: (#1763)
1. The "conformance_automated" was not written to the output in some cases. 2. The output file was not written if it didn't previously exist and the tests passed. This doesn't change the results of any of the tests.
1 parent 77cc3a7 commit 9a21598

9 files changed

+21
-3
lines changed

conformance/results/mypy/constructors_consistency.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ conformant = "Pass"
22
notes = """
33
Does not report inconsistency between __new__ and __init__ (optional).
44
"""
5+
conformance_automated = "Pass"
6+
errors_diff = """
7+
"""
8+
output = """
9+
"""

conformance/results/mypy/exceptions_context_managers.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ errors_diff = """
33
"""
44
output = """
55
"""
6+
conformance_automated = "Pass"

conformance/results/pyre/constructors_call_type.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ constructors_call_type.py:72:4 Missing argument [20]: Call `Meta1.__call__` expe
1111
constructors_call_type.py:81:4 Missing argument [20]: Call `Class2.__new__` expects argument `y`.
1212
constructors_call_type.py:82:11 Incompatible parameter type [6]: In call `Class2.__new__`, for 2nd positional argument, expected `str` but got `int`.
1313
"""
14+
conformance_automated = "Pass"

conformance/results/pyre/constructors_consistency.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ conformant = "Pass"
22
notes = """
33
Does not report inconsistency between __new__ and __init__ (optional).
44
"""
5+
conformance_automated = "Pass"
6+
errors_diff = """
7+
"""
8+
output = """
9+
"""

conformance/results/pyright/constructors_call_new.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ constructors_call_new.py:145:1 - error:
1010
    Type "type[Class11[str]]" is incompatible with type "type[Class11[int]]"
1111
      Type parameter "T@Class11" is invariant, but "str" is not the same as "int" (reportGeneralTypeIssues)
1212
"""
13+
conformance_automated = "Pass"

conformance/results/pyright/constructors_consistency.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ constructors_consistency.py:25:9 - error: Mismatch between signature of __new__
66
  Signature of __init__ is "(x: str)"
77
  Signature of __new__ is "()" (reportInconsistentConstructor)
88
"""
9+
conformance_automated = "Pass"

conformance/results/pyright/exceptions_context_managers.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ errors_diff = """
33
"""
44
output = """
55
"""
6+
conformance_automated = "Pass"

conformance/results/pytype/constructors_consistency.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ errors_diff = """
77
output = """
88
99
"""
10+
conformance_automated = "Pass"

conformance/src/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ def update_output_for_test(
141141

142142
results_file = results_dir / f"{test_name}.toml"
143143
results_file.parent.mkdir(parents=True, exist_ok=True)
144+
should_write = False
144145

145146
# Read the existing results file if present.
146147
try:
@@ -153,7 +154,6 @@ def update_output_for_test(
153154
print(f"Error decoding {results_file}")
154155
existing_results = {}
155156

156-
should_write = False
157157
ignored_errors = existing_results.get("ignore_errors", [])
158158
errors_diff = "\n" + diff_expected_errors(type_checker, test_case, output, ignored_errors)
159159
old_errors_diff = "\n" + existing_results.get("errors_diff", "")
@@ -165,8 +165,10 @@ def update_output_for_test(
165165
print(f"New output: {errors_diff}")
166166
print("")
167167

168-
existing_results["conformance_automated"] = "Fail" if errors_diff.strip() else "Pass"
169-
168+
conformance_automated = "Fail" if errors_diff.strip() else "Pass"
169+
if existing_results.get("conformance_automated") != conformance_automated:
170+
should_write = True
171+
existing_results["conformance_automated"] = conformance_automated
170172

171173
old_output = existing_results.get("output", "")
172174
old_output = f"\n{old_output}"

0 commit comments

Comments
 (0)