hedy icon indicating copy to clipboard operation
hedy copied to clipboard

Fix test suite on windows

Open bjorn3 opened this issue 3 years ago • 1 comments

Two tests seem to be failing on windows. The test_yamlfile.py failure is caused by atomic_write_file, which is used by YamlFile, not working on Windows.

bjorn3 avatar Oct 26 '21 13:10 bjorn3

@Mark-Giesen No rush of course but maybe you can pick this up too when you start? Do you also experience this issue?

Felienne avatar Jan 19 '22 16:01 Felienne

Well, no rush indeed :-). This issue was solved by no longer using atomic writes. It simply renames the file. This is atomic and silent if destination exists on *ix systems, but results in an exception on Windows, which is swallowed. This could have been closed, but good it didn't. Renewed investigation found this "bug-fix": https://bugs.python.org/issue8828. It introduces replace() as alternative to rename() to get consistent behavior (and atomic if successful) between OS's. I think this might be a good idea and solve this issue for good now. See also: https://docs.python.org/3/library/os.html and https://stackoverflow.com/questions/69363867/difference-between-os-replace-and-os-rename (since stackoverflow is always right :-)) @rix0rrr or @Felienne, am I missing something?

Mark-Giesen avatar Oct 25 '22 20:10 Mark-Giesen

Hi @Mark-Giesen, since it is "fixed" and there is so much going on, we won't be diving into this further atm. Of course if you want to submit a PR, feel free to do so but I am of the opinion that there is a lot of other things we all could be fixing.

Felienne avatar Oct 26 '22 05:10 Felienne

Just cleaning up my @mentions :-).

Mark-Giesen avatar Oct 26 '22 07:10 Mark-Giesen