Skip to content

Conversation

@johntemyra
Copy link

recordfilehandler: write to a buffered file which is kept open throughout its lifetime
capturepython: switch from using inspect.stack() to sys._getframe()

recordfilehandler: write to a buffered file which is kept open throughout its lifetime
capturepython: switch from using inspect.stack() to sys._getframe()
@johntemyra
Copy link
Author

I've tested the python_attributes tests and they are ok except for an empty file which is created for one of the tests.
Can't get the tests that uses the capturemock binary to run.
Need some instructions/hints on how to make them run.

@gjb1002
Copy link
Contributor

gjb1002 commented Jan 28, 2026

I fetched the branch and ran the tests (on Windows). Most of them fail for me.
python_attributes tests mostly raise an exception [WinError 32] The process cannot access the file because it is being used by another process:. Suspect this error may be specific to Windows, don't think Linux cares about such things...

server-based tests generally raise an exception: ValueError: I/O operation on closed file.
So something seems a bit wrong with recordfilehandler.py. Haven't yet looked at the code.

@gjb1002
Copy link
Contributor

gjb1002 commented Jan 28, 2026

I will be working at home tomorrow though, so can probably test this on Linux there then.

@johntemyra
Copy link
Author

johntemyra commented Jan 28, 2026

Now I also checked on windows tests. Turns out that windows can't close open files but linux can... Didn't know that.
I pushed a fix for the unclosed files but I still get some failed tests in the python_attributes test cases (functional and exceptions).
There are files and folders created that shouldn't and also more concerning, is that some of the replayed files are messed up.
I need to take a closer look on why that is.

When I try to run other tests than the python_attributes I get this error:
image
Same as on linux (but without the exe). I don't know where I would get the binary from other than building it (from the same source) but that fails the tests miserably.

@gjb1002
Copy link
Contributor

gjb1002 commented Jan 29, 2026

That error looks like you're pointing out your source code checkout. You need to point "use checkout" (or -c on the command line) to the virtual environment where you've installed capturemock, also on Linux. When you install it should create capturemock.exe on Windows. No need to build anything.

I ran the tests on my Ubuntu laptop now. A handful of failures - it's been quite a while since I ran these tests on Linux! A few tests have external dependencies and are fixed by installing "pyftpdlib" and "opcua" with pip, some more have filtering issues which I will fix. Leaves 2 that are failing for unknown reasons, but both are quite specific functionality that probably isn't relevant to you.

@gjb1002
Copy link
Contributor

gjb1002 commented Jan 29, 2026

Fixed the filtering issues in my above comment now. Should only be 2 red tests on clean Linux now, after installing the listed modules.

@johntemyra
Copy link
Author

That sounds promising when you put it like that. The differences in capturemock files looks ominous though. Thanks for looking into the issues and of course that you take the time to respond so quickly.
I'll see if I can take a look at it later today.
Have you tried running the tests on windows also? Did you get the same errors there (after the last commit)?

@gjb1002
Copy link
Contributor

gjb1002 commented Jan 29, 2026

I haven't tried to run your branch on Linux yet. My comments re: Linux were based on running the latest code in master.

I got your latest change on Windows, only one failure for me under python_attributes now, the test "socket_module_unused". Server-based tests are still all failing in the same way as I mentioned before.

@johntemyra
Copy link
Author

johntemyra commented Jan 29, 2026

Ah! Ok, I understand, it was the tests without the change that you described. I'll see if I can get the server based texts going and fix the failing ones with the change.

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.

3 participants