The unit test tests.test_jsonexporter.test_json_exporter doesn't work on Windows.
In the fragment bellow:
with NamedTemporaryFile(mode="w+") as ref:
with NamedTemporaryFile(mode="w+") as gen:
ref.write("\n".join(lines))
exporter.write(root, gen)
assert filecmp.cmp(ref.name, gen.name)
The filecmp.cmp function failed because the files are still opened.
The exception is:
Traceback (most recent call last):
...
File "C:\Program Files\Python38\lib\filecmp.py", line 75, in _do_cmp
with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2:
PermissionError: [Errno 13] Permission denied: 'C:\\...\\AppData\\Local\\Temp\\tmpgr3lyx2m'
The solution is to close the files before comparison.
The unit test
tests.test_jsonexporter.test_json_exporterdoesn't work on Windows.In the fragment bellow:
The
filecmp.cmpfunction failed because the files are still opened.The exception is:
The solution is to close the files before comparison.