You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the full test suite using python -m pytest, failures may happen in the docs/examples/basics.rst test suite if the terminal width is not 80 columns.
The issue seems to be with tables, where python only displays a subset of the columns to fit the terminal width. A larger terminal produces more columns, and therefore deviates from the expected result.
Similarly, a narrower terminal produces less columns, which also deviates from the expected result.
============================================================================= FAILURES =============================================================================
_______________________________________________________________________ [doctest] basics.rst _______________________________________________________________________
205 this session. For this, it is first necessary to call
206 :func:`Session.load <fastf1.core.Session.load>`. This will load all available data for the
207 session from various APIs. Downloading and processing of the data may take a
208 few seconds. It is highly recommended to utilize FastF1's builtin caching209 functionality to speed up data loading and to prevent excessive API requests.210211 >>> fastf1.Cache.enable_cache("path/to/empty/folder") # doctest: +SKIP212 >>> session = fastf1.get_session(2021, 'French Grand Prix', 'Q')213 >>> session.load()214 >>> session.resultsDifferences (unified diff with -expected +actual): @@ -1,23 +1,23 @@ - DriverNumber BroadcastName Abbreviation ... Time Status Points -33 33 M VERSTAPPEN VER ... NaT NaN -44 44 L HAMILTON HAM ... NaT NaN -77 77 V BOTTAS BOT ... NaT NaN -11 11 S PEREZ PER ... NaT NaN -55 55 C SAINZ SAI ... NaT NaN -10 10 P GASLY GAS ... NaT NaN -16 16 C LECLERC LEC ... NaT NaN -4 4 L NORRIS NOR ... NaT NaN -14 14 F ALONSO ALO ... NaT NaN -3 3 D RICCIARDO RIC ... NaT NaN -31 31 E OCON OCO ... NaT NaN -5 5 S VETTEL VET ... NaT NaN -99 99 A GIOVINAZZI GIO ... NaT NaN -63 63 G RUSSELL RUS ... NaT NaN -47 47 M SCHUMACHER MSC ... NaT NaN -6 6 N LATIFI LAT ... NaT NaN -7 7 K RAIKKONEN RAI ... NaT NaN -9 9 N MAZEPIN MAZ ... NaT NaN -18 18 L STROLL STR ... NaT NaN -22 22 Y TSUNODA TSU ... NaT NaN + DriverNumber BroadcastName Abbreviation TeamName TeamColor ... Q2 Q3 Time Status Points +33 33 M VERSTAPPEN VER Red Bull Racing 0600EF ... 0 days 00:01:31.080000 0 days 00:01:29.990000 NaT NaN +44 44 L HAMILTON HAM Mercedes 00D2BE ... 0 days 00:01:30.788000 0 days 00:01:30.248000 NaT NaN +77 77 V BOTTAS BOT Mercedes 00D2BE ... 0 days 00:01:30.735000 0 days 00:01:30.376000 NaT NaN +11 11 S PEREZ PER Red Bull Racing 0600EF ... 0 days 00:01:30.971000 0 days 00:01:30.445000 NaT NaN +55 55 C SAINZ SAI Ferrari DC0004 ... 0 days 00:01:31.146000 0 days 00:01:30.840000 NaT NaN +10 10 P GASLY GAS AlphaTauri 2B4562 ... 0 days 00:01:31.353000 0 days 00:01:30.868000 NaT NaN +16 16 C LECLERC LEC Ferrari DC0004 ... 0 days 00:01:31.567000 0 days 00:01:30.987000 NaT NaN +4 4 L NORRIS NOR McLaren FF9800 ... 0 days 00:01:31.542000 0 days 00:01:31.252000 NaT NaN +14 14 F ALONSO ALO Alpine 0090FF ... 0 days 00:01:31.549000 0 days 00:01:31.340000 NaT NaN +3 3 D RICCIARDO RIC McLaren FF9800 ... 0 days 00:01:31.615000 0 days 00:01:31.382000 NaT NaN +31 31 E OCON OCO Alpine 0090FF ... 0 days 00:01:31.736000 NaT NaT NaN +5 5 S VETTEL VET Aston Martin 006F62 ... 0 days 00:01:31.767000 NaT NaT NaN +99 99 A GIOVINAZZI GIO Alfa Romeo Racing 900000 ... 0 days 00:01:31.813000 NaT NaT NaN +63 63 G RUSSELL RUS Williams 005AFF ... 0 days 00:01:32.065000 NaT NaT NaN +47 47 M SCHUMACHER MSC Haas F1 Team FFFFFF ... NaT NaT NaT NaN +6 6 N LATIFI LAT Williams 005AFF ... NaT NaT NaT NaN +7 7 K RAIKKONEN RAI Alfa Romeo Racing 900000 ... NaT NaT NaT NaN +9 9 N MAZEPIN MAZ Haas F1 Team FFFFFF ... NaT NaT NaT NaN +18 18 L STROLL STR Aston Martin 006F62 ... NaT NaT NaT NaN +22 22 Y TSUNODA TSU AlphaTauri 2B4562 ... NaT NaT NaT NaN <BLANKLINE> [20 rows x 16 columns]
The text was updated successfully, but these errors were encountered:
Yes, I know about this one. I have already wasted a considerable amount of time with this, but without reasonable success.
In theory, pandas has settings for this to set a fixed with. In practice, they don't seem to work with pytest. I tried figuring out from pandas' own test setup but failed because it is way more complex. Generally, people running doctests on DataFrames are a bit sparse, so there's not that much information out there, it seems.
At some point I just settled with "works in CI" and "works in PyCharm's default console" i. e. I can run tests locally and get the same result as the CI. Not many people are actually trying to run the test suit for FastF1. And at some point the amount of time I started wasting on this was not justifiable.
If someone can find a reliable fix for this, I'll be very happy.
Looks somewhat promising. I don't think I've tried an autouse fixture before but I'm not sure. I still haven't fully understood how pytest interacts with modules like doctest. I'll give it a try.
Describe the issue:
When running the full test suite using
python -m pytest
, failures may happen in thedocs/examples/basics.rst
test suite if the terminal width is not 80 columns.The issue seems to be with tables, where python only displays a subset of the columns to fit the terminal width. A larger terminal produces more columns, and therefore deviates from the expected result.
Similarly, a narrower terminal produces less columns, which also deviates from the expected result.
Reproduce the code example:
Error message:
The text was updated successfully, but these errors were encountered: