kozaka-tv / Rocksmith-Servant

MIT License
6 stars 5 forks source link

Fix test and chdir problem #220

Closed kozaka-tv closed 3 months ago

kozaka-tv commented 3 months ago

After the chdir was introduced into the project, some tests having problems with the extracted CDLC file. It is looks like, files will be generated under the user appData dir.

test_input = C:\work\PycharmProjects\Rocksmith-Servant\tests\testdata\cdlc\AC-DC_Big-Gun_v3_5_DD_p.psarc

ERROR:

entry = {'filepath': 'manifests/songs_dlc_acdcbiggunsingle/songs_dlc_acdcbiggunsingle.hsan', 'length': 7192, 'offset': 6020601, 'zindex': 287, ...} filename_to_extract = 'C:\work\PycharmProjects\Rocksmith-Servant\tests\testdata\cdlc\AC-DC_Big-Gun_v3_5_DD_p.psarc' psarc = <_io.BufferedReader name='C:\\work\\PycharmProjects\\Rocksmith-Servant\\tests\\testdata\\cdlc\\AC-DC_Big-Gun_v3_5_DD_p.psarc'>

def __write_info_file(entry, filename_to_extract, psarc):
    # TODO this writes out the data into a file if needed
    json_filename = filename_to_extract + EXT_PSARC_INFO_JSON
    info_file_json_path = os.path.join(PSARC_INFO_FILE_CACHE_DIR, os.path.basename(json_filename))
    data_to_write = __read_entry_data(psarc, entry)
  with open(info_file_json_path, 'wb') as fstream:

E FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\kozaka\AppData\Local\Programs\PyCharm Professional\plugins\python\helpers\pycharm\cache\psarc-info-files\AC-DC_Big-Gun_v3_5_DD_p.psarc.info.json'

..\utils\psarc_reader.py:189: FileNotFoundError