Some test_mksession tests do not cleanup all the state by illia-bobyr · Pull Request #20691 · vim/vim · GitHub
Skip to content

Some test_mksession tests do not cleanup all the state#20691

Closed
illia-bobyr wants to merge 1 commit into
vim:masterfrom
illia-bobyr:pr/test_mksession-cleanup-dependencies
Closed

Some test_mksession tests do not cleanup all the state#20691
illia-bobyr wants to merge 1 commit into
vim:masterfrom
illia-bobyr:pr/test_mksession-cleanup-dependencies

Conversation

@illia-bobyr

Copy link
Copy Markdown
Contributor

Problem: Some test_mksession tests do not cleanup all the state
Solution: Add commands to clean up state introduced by the test

Before this change the following 4 tests were failing when executed individually:

Test_mksession_arglocal_localdir
Test_mksession_buffer_count
Test_mksession_one_buffer_two_windows
Test_mksession_winminheight

As in

  TEST_FILTER=winminheight make test_mksession

Yet, when ran as part of the whole test suite they succeeded.

This was due to some state leaking from one test into another.

I think this is bad, as it can confuse someone making changes in the relevant area.

Test_mksession_winminheight is actually still broken a bit, and requires winheight and winwidth set at the beginning of the test, rather than later, when it actually matters. This exposes a subtle bug in the session restore script. I have a patch in a separate commit.


Reviewer note.

Not sure if the change in Test_mksession_localmappings() is justified.
The minimum change would be to just add set sessionoptions& at the end.
But a try/finally block makes sure that a failure would not prevent the cleanup from happening.
I do not know if this is an issue in the first place.
I can see that try/finally is used in the test, but not a lot.

@illia-bobyr illia-bobyr force-pushed the pr/test_mksession-cleanup-dependencies branch from f21d6e7 to 8fc4b5e Compare July 2, 2026 23:49
Problem:  Some test_mksession tests do not cleanup all the state
Solution: Add commands to clean up state introduced by the test

Before this change the following 4 tests were failing when executed
individually:

  Test_mksession_arglocal_localdir
  Test_mksession_buffer_count
  Test_mksession_one_buffer_two_windows
  Test_mksession_winminheight

As in
```
  TEST_FILTER=winminheight make test_mksession
```
Yet, when ran as part of the whole test suite they succeeded.

This was due to some state leaking from one test into another.

I think this is bad, as it can confuse someone making changes in the
relevant area.

`Test_mksession_winminheight` is actually still broken a bit, and
requires `winheight` and `winwidth` set at the beginning of the test,
rather than later, when it actually matters.  This exposes a subtle bug
in the session restore script.  I have a patch in a separate commit.
@chrisbra

chrisbra commented Jul 3, 2026

Copy link
Copy Markdown
Member

@chrisbra chrisbra closed this in 834b8d2 Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants