Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add python 3.12 to test #469

Merged
merged 8 commits into from
Oct 19, 2023
Merged

Add python 3.12 to test #469

merged 8 commits into from
Oct 19, 2023

Conversation

Casper-Guo
Copy link
Contributor

Reference: #468

@Casper-Guo
Copy link
Contributor Author

@theOehrly

Python version: 3.11.5

Running this will throw the same KeyError:

import fastf1

event = fastf1.get_event(2023, 4, backend="f1timing")

I am not sure why this wasn't caught before by the other tests.

The offending JSON is the last one. The Name key is missing.:

[
   {
      "Key":9278,
      "Type":"Qualifying",
      "Number":-1,
      "Name":"Sprint Shootout",
      "StartDate":"2023-04-29T12:30:00",
      "EndDate":"2023-04-29T13:14:00",
      "GmtOffset":"04:00:00",
      "Path":"2023/2023-04-30_Azerbaijan_Grand_Prix/2023-04-29_Sprint_Shootout/"
   },
   {
      "Key":9282,
      "Type":"Qualifying",
      "Number":-1,
      "Name":"Sprint Shootout",
      "StartDate":"2023-07-01T12:00:00",
      "EndDate":"2023-07-01T12:44:00",
      "GmtOffset":"02:00:00",
      "Path":"2023/2023-07-02_Austrian_Grand_Prix/2023-07-01_Sprint_Shootout/"
   },
   {
      "Key":9286,
      "Type":"Qualifying",
      "Number":-1,
      "Name":"Sprint Shootout",
      "StartDate":"2023-07-29T12:00:00",
      "EndDate":"2023-07-29T12:44:00",
      "GmtOffset":"02:00:00",
      "Path":"2023/2023-07-30_Belgian_Grand_Prix/2023-07-29_Sprint_Shootout/"
   },
   {
      "Key":-1,
      "Type":"Qualifying",
      "StartDate":"2023-10-07T16:00:00",
      "EndDate":"2023-10-07T16:44:00",
      "GmtOffset":"03:00:00"
   }
]

@Casper-Guo
Copy link
Contributor Author

Casper-Guo commented Oct 17, 2023

Above are all the responses that are processed by this segment. The log is showing the different event['Sessions'][2]

@theOehrly
Copy link
Owner

@Casper-Guo thank you for digging into this already. I figured out the reason for this weird behaviour already. The problem is that the data for the Qatar GP is garbage. Somehow, the F1 API lists 8 sessions for this GP. More specifically, the sessions listed at index 2, 4, 6 are not actual sessions. The parser expects exactly five sessions, and the error occurs because the session at index 2 is one of the garbage entries and has no name.
This problem does not occur in the other python version tests because of caching. They are using older cached HTTP requests that do not yet include the faulty data for the Qatar GP. There's no cache for the new CI test yet and therefore it pulls the latest data.

Therefore, this is not a bug with Python 3.12, but a general bug that just came up now and is partially masked by caching.

@theOehrly
Copy link
Owner

There are a bunch of deprecation warnings that are new on Python 3.12. Those should be fixed, before adding Python 3.12 to the test matrix.

@Casper-Guo
Copy link
Contributor Author

Looks like those deprecation warnings are generated for packages that we rely on for datetime processing. I am unsure what needs fixing inside FastF1 just reading the test output

@theOehrly
Copy link
Owner

Looks like those deprecation warnings are generated for packages that we rely on for datetime processing. I am unsure what needs fixing inside FastF1 just reading the test output

You're right. I didn't read the log properly. Those warnings can't be fixed in FastF1. Then they should be added to the ignore list in pytest.ini in the filterwarnings list, below the "external, ..." comment and with a current date indicating when they were added. Can you do that? Else I can push the commit to this branch.

Additionally, please rebase/merge master. I've fixed the event schedule bug caused by the errors in the data for the Qatar GP.

@Casper-Guo
Copy link
Contributor Author

Ok, passing the tests now

@theOehrly
Copy link
Owner

theOehrly commented Oct 19, 2023

There were still some warnings. I just pushed the fixed now, because I had it already done when I figured it out. It was just a minor thing. The special characters in the ignore regex need to be escaped.

@theOehrly theOehrly merged commit 364e390 into theOehrly:master Oct 19, 2023
8 checks passed
@Casper-Guo Casper-Guo deleted the python-3.12 branch October 19, 2023 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants