Skip to content

Commit efac952

Browse files
pseewaldzandivxclaudestigh
authored
201 test failures (#202)
* clarifying missing reset of test directory in documentation * temporarily undo problematic change to detect misaligned lines * Tests: make tests for non-whitespace changes less strict (ignore new line characters) * clarify how to disable auto line break * Tests: ignore inserted ampersands * update test results * adding unit test expected to fail due to removed statement label * Preserve statement labels during auto line-splitting (#1) When write_formatted_line splits a long line (via _insert_split_chunks or _detach_inline_comment), the statement label was consumed but never restored for the replacement lines. This caused labels like "1003" to be silently dropped from FORMAT statements that exceeded the line length limit. Three issues addressed in write_formatted_line: - Restore the label after split/detach so it appears on the first chunk - In the overflow fallback path, prepend the label when orig_line lacks it - When detaching an inline comment from a labeled line, compensate the comment's indent for the label-replacement space inflation Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * updating test results * formatting * fix: make auto line-splitting idempotent (#2) * clarifications regarding integration test setup *  add newest python versions * minor readme fixes --------- Co-authored-by: Andreas Zach <80193776+zandivx@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Stig Helgeland <stig@pions.no>
1 parent b5df13b commit efac952

6 files changed

Lines changed: 130 additions & 57 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
os: [ubuntu-latest]
18-
python: ["3.10", "3.11", "3.12"]
18+
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1919

2020
steps:
2121
- name: Checkout code

‎README.md‎

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,22 @@ For `suite`, you should pick one of the following test suites:
221221
- `regular`: for small code bases (executed for every pull request)
222222
- `cron`: for larger code bases (executed nightly)
223223

224+
Upon running an integration test, `fprettify` is applied in-place to Fortran
225+
code checked out under `fortran_tests/test_code`. Note that upon running tests
226+
twice, the output of the first run is the new input of the second run. A reset
227+
can be achieved by removing `fortran_tests/test_code`. Running integration
228+
tests multiple times is an important check for idempotency, i.e. that running
229+
`fprettify` twice doesn't alter results (not yet checked
230+
automatically).
231+
232+
In case of a test failure, the reported diff just shows input vs. output. Note
233+
that this diff is usually not related to the test failure, as it shows all
234+
changes relative to the *unformatted* Fortran code (from an external source).
235+
To get a diff specifically relative to the *expected* output, you need to run
236+
integration test first with the reference version of `fprettify`, then with the
237+
version of `fprettify` causing the failure. Backups of each test run's input
238+
are stored as `fortran_tests/test_code_in_<date-time>`.
239+
224240

225241
### How to locally run all unit and integration tests:
226242

@@ -243,27 +259,29 @@ For `suite`, you should pick one of the following test suites:
243259
`./run_tests.py -n ...`
244260

245261

246-
### How to deal with test failures
262+
### How to debug and fix test failures
247263

248264
Test failures are always due to fprettify-formatted code being different than
249265
expected. To examine what has changed, proceed as follows:
250266
- Unit tests: failures should be rather easy to understand because the test
251267
output shows the diff of the actual vs. expected result.
252268
- Integration tests: we don't store the expected version of Fortran code,
253269
instead we compare SHA256 checksums of the actual vs. expected result. The
254-
test output shows the diff of the actual result vs. the *previous* version of
255-
the code (that is, the version before `fprettify` was applied). Thus, in
256-
order to obtain the diff of the actual vs. the *expected* result, the
257-
following steps need to be executed:
258-
259-
1. Run `./run_tests.py -s` followed by the name of the failed test suite. Check
260-
the test output for lines mentioning test failures such as:
261-
`Test top-level-dir/subdir/file.f (fprettify.tests.fortrantests.FprettifyIntegrationTestCase) ... checksum FAIL`.
262-
2. Check out the reference version of `fprettify` for which the test passes (normally, `develop` branch).
263-
3. Run the integration test(s) via `./run_tests.py -n top-level-dir` (replacing
270+
test output shows the diff of the actual result vs. the *original* version of
271+
the Fortran code (that is, the version before `fprettify` was applied). In
272+
order to get a meaningful diff (specific to the failure), you need to first
273+
run the test with the reference version of fprettify (for which the test
274+
passes), then with the fprettify version causing the failure.
275+
276+
More specifically, the following steps need to be executed for a test
277+
failure, which is assumed to be reported as
278+
`Test top-level-dir/subdir/file.f (fprettify.tests.fortrantests.FprettifyIntegrationTestCase) ... checksum FAIL`:
279+
280+
1. Check out the reference version of `fprettify` for which the test passes (normally, `master` branch).
281+
2. Run the integration test(s) via `./run_tests.py -n top-level-dir` (replacing
264282
`top-level-dir` with the actual directory mentioned in the test output).
265-
4. Check out the version of `fprettify` for which the test failed and run the integration tests again.
266-
5. Now the `diff` shown in the test output shows the exact changes which caused the test to fail.
283+
3. Check out the version of `fprettify` for which the test failed and run the integration tests again.
284+
4. Now the `diff` shown in the test output shows the exact changes which caused the test to fail.
267285

268286
If you decide to accept the changes as new test references, proceed as follows:
269287
- Unit tests: update the expected test result within the respective test method (third argument to function `self.assert_fprettify_result`)

0 commit comments

Comments
 (0)