Metron-Project / metron-tagger

Command line tool to tag comic archives with metadata from Metron Comic Book Database.
https://metron.cloud/
GNU General Public License v3.0
20 stars 1 forks source link

Fix tox failure on Windows #51

Closed bpepple closed 3 years ago

bpepple commented 3 years ago

Describe the bug Running tox tests on windows, causes the following error:

 =================================== ERRORS ====================================
________________ ERROR collecting tests/test_metron_tagger.py _________________
tests\test_metron_tagger.py:10: in <module>
    from metrontagger.main import (
metrontagger\main.py:17: in <module>
    SETTINGS = MetronTaggerSettings()
metrontagger\settings.py:36: in __init__
    folder = MetronTaggerSettings.get_settings_folder()
metrontagger\settings.py:19: in get_settings_folder
    windows_path = PurePath(environ["APPDATA"]).joinpath("MetronTagger")
C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\os.py:675: in __getitem__
    raise KeyError(key) from None
E   KeyError: 'APPDATA'
=========================== short test summary info ===========================
ERROR tests/test_metron_tagger.py - KeyError: 'APPDATA'
!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
============================== 1 error in 0.26s ===============================
ERROR: InvocationError for command 'C:\Users\runneradmin\AppData\Roaming\Python\Scripts\bin\poetry.EXE' run pytest tests/ (exited with code 2)

Desktop:

Additional context Looks like this code is causing the problem: https://github.com/bpepple/metron-tagger/blob/2b4a86efc6703d66ed893fefb8338b6b0ffa1410/metrontagger/settings.py#L19

Need to see how this information should be retrieved (tho since I don't have a windows machine it will probably require a bit of google-fu).

bpepple commented 3 years ago

Turn out the test was failing due to the setting being loaded as a public variable. Fixed in #50