Skip to content

Unit tests for the userio module helpers.#461

Open
jonasbardino wants to merge 2 commits intonextfrom
add/mig-shared-userio-unit-tests
Open

Unit tests for the userio module helpers.#461
jonasbardino wants to merge 2 commits intonextfrom
add/mig-shared-userio-unit-tests

Conversation

@jonasbardino
Copy link
Contributor

@jonasbardino jonasbardino commented Feb 15, 2026

Fundamental unit tests for the userio helpers including regression tests for issue #460 to be enabled along with the fix. Increasing tests coverage is easy now that the basic structure is in place for generating them.

@jonasbardino jonasbardino self-assigned this Feb 15, 2026
@jonasbardino jonasbardino added the test-only Improvements or additions solely for better test coverage - without functionality changes label Feb 15, 2026
@jonasbardino jonasbardino marked this pull request as ready for review February 15, 2026 22:02
@jonasbardino jonasbardino requested a review from a team February 15, 2026 22:02
@jonasbardino jonasbardino changed the title Basic unit tests for some of the userio helpers. Unit tests for the userio module helpers. Feb 15, 2026
jonasbardino added a commit that referenced this pull request Feb 17, 2026
…459)

* Fix a regression in the recent addition of transparent compression in `userio`
module. The resulting file in `events_home` would silently fail during writes
for the compressed cases due to a subtle bytes vs str issue for gzip and bz2
file handles, when using mode strings without a specific binary or text marker.
They default to open in binary mode in that case, which breaks writing of plain
strings with an error like:
`memoryview: a bytes-like object is required, not 'str'`

To make matters worse our old built-in self-tests did not verify the written
event files at all, so when they weren't created it looked like things were
alright.

Adjusted the gzip and bz2 compression cases to explicitly use text mode for
regular string writing to address the regression.

Reworked the self-tests to include careful verification of the written event
files and their contents as a regression test. It was necessary to expose the
event timestamps as an optional arg in the function APIs to enable such
testing.
Also addressed a minor issue with the clean-up helper not fully cleaning up
after 'remove' tests, where the data is really moved into the user Trash folder
in the root of the user home.

Further modern unit tests of the `userio` module are ready in #461.
@jonasbardino jonasbardino force-pushed the add/mig-shared-userio-unit-tests branch from db2c955 to bc804d4 Compare February 24, 2026 18:17
@jonasbardino jonasbardino force-pushed the add/mig-shared-userio-unit-tests branch from bc804d4 to fe95c0a Compare February 25, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-only Improvements or additions solely for better test coverage - without functionality changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant