snipem / gt7dashboard

Gran Turismo 7 Race Telemetry Dashboard
GNU General Public License v3.0
177 stars 30 forks source link

Support Windows file path and general minor fixes #1

Closed SteveMattar closed 1 year ago

SteveMattar commented 1 year ago
snipem commented 1 year ago

I got this error running the test files:

python3 -m pytest
========================== test session starts ==========================
platform darwin -- Python 3.10.6, pytest-7.1.3, pluggy-1.0.0
rootdir: /Users/xxx/work/gt7telemetry
collected 21 items

test_gt7communication.py ss                                       [  9%]
test_gt7helper.py ..F................                             [100%]

=============================== FAILURES ================================
______ TestHelper.test_calculate_time_diff_by_distance_from_pickle ______

self = <test_gt7helper.TestHelper testMethod=test_calculate_time_diff_by_distance_from_pickle>

    def test_calculate_time_diff_by_distance_from_pickle(self):
        path = os.path.join(os.path.abspath(__file__), 'test_data', 'tsukuba_2laps_rain_first_is_best.pickle')
>       laps = gt7helper.load_laps_from_pickle(path)

test_gt7helper.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

path = '/Users/xxx/work/gt7telemetry/test_gt7helper.py/test_data/tsukuba_2laps_rain_first_is_best.pickle'

    def load_laps_from_pickle(path: str) -> List[Lap]:
>       with open(path, "rb") as f:
E       NotADirectoryError: [Errno 20] Not a directory: '/Users/xxx/work/gt7telemetry/test_gt7helper.py/test_data/tsukuba_2laps_rain_first_is_best.pickle'

gt7helper.py:323: NotADirectoryError
=========================== warnings summary ============================
../../../../usr/local/lib/python3.10/site-packages/salsa20.py:11
  /usr/local/lib/python3.10/site-packages/salsa20.py:11: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
    import imp

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== short test summary info ========================
FAILED test_gt7helper.py::TestHelper::test_calculate_time_diff_by_distance_from_pickle
========== 1 failed, 18 passed, 2 skipped, 1 warning in 2.26s ===========
make: *** [test] Error 1
snipem commented 1 year ago

Here is the same error in the workflow: https://github.com/SteveMattar/gt7dashboard/actions/runs/4276463317/jobs/7444570299#step:5:46

SteveMattar commented 1 year ago

Hey, sorry for seeing your message just now. Did you manage to fix it? According to the logs, I see that the test generates a wrong path - it includes the file test_gt7helper.py in the middle

path = '/Users/xxx/work/gt7telemetry/test_gt7helper.py/test_data/tsukuba_2laps_rain_first_is_best.pickle'
snipem commented 1 year ago

Yes I fixed it 3a7bfde