test_pc_file fails on Windows
Because the temporary file is already opened before calling the save
attribute of the pc object, Windows does not allow the file to be re-opened (because it is already open). Traceback below.
My solution will be to create a file in a temporary directory instead of a temporary file directly. Should be platform-independent.
.E
======================================================================
ERROR: test_write_PCFile (__main__.TestPCFile)
Round-trip loading and saving a pc file
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\rink\git\WindEnergyToolbox\wetb\hawc2\tests\test_pc_file.py", line 51, in test_write_PCFile
pc1.save(fid.name)
File "c:\users\rink\git\windenergytoolbox\wetb\hawc2\pc_file.py", line 159, in save
with open(filename, 'w') as fid:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\rink\\AppData\\Local\\Temp\\tmpsomciutv'
----------------------------------------------------------------------
Ran 2 tests in 0.012s
FAILED (errors=1)