Skip to content

Fix tests on Windows #99

Open
Open

Description

@vgreg

It seems that the tests are not working properly on Windows. We should confirm the issue and fix the tests so that they work on all major platforms.

Activity

  1. jevwithwind commented on Jul 4, 2026

    @jevwithwind

    Hi! I'm doing similar work with limit order book data on the JPX side (master's research) with a Windows PC, and recently stumbled across MeatPy. This issue looked like something I could help with, so I dug into the failures — here's the diagnosis, in case it's useful.

    Reproduced on Windows 11 (current main): 38 failures, all in test code — the library itself is Windows-clean.

    Two root causes, both in how the tests manage temp files:

    1. 36 tests hold a tempfile.NamedTemporaryFile(delete=False) handle open for the whole test body and call Path(tmp.name).unlink() inside the with block. POSIX allows unlinking an open file; Windows raises PermissionError (WinError 32). Affects test_csv_writer.py, test_parquet_writer.py, test_writers.py, test_recorders.py.
    2. The two test_itch50_reader_writer.py failures use the default delete=True, which on Windows opens the file with O_TEMPORARY — so ITCH50Writer's own re-open of the same path (itch50_writer.py:81) fails with Errno 13 at flush.

    The writers themselves are fine — every library-side open is context-scoped, so no product code needs to change.

    I have a minimal fix passing the full suite locally (659 passed; ruff clean): converting the five affected test files to pytest's tmp_path fixture, which removes the manual cleanup entirely and behaves identically on Linux. Happy to open a PR if that's useful, or leave the diagnosis here if you'd rather take it yourself.

    Two smaller things I noticed and left alone: test_itch2_reader.py uses the same idiom (it passes, but leaks temp files since it never unlinks), and a windows-latest leg in test.yml would lock the fix in. Glad to fold either into the PR or a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions