Skip to content

Commit

Permalink
CI: add warning when not in pandas dev and running stubtest (#48267)
Browse files Browse the repository at this point in the history
* add warning when not in pandas dev and running stubtest

* add url to the warning

* add trailing underscore in version

* Format the warning message

* resolve review comments

Co-authored-by: Ambuj Pawar <ambuj.pawar95@gmail.com>
  • Loading branch information
ambujpawar and Ambuj Pawar authored Aug 26, 2022
1 parent e97b082 commit 9757d1f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion scripts/run_stubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,26 @@

import pandas as pd

pd_version = getattr(pd, "__version__", "")

# fail early if pandas is not installed
if not getattr(pd, "__version__", ""):
if not pd_version:
# fail on the CI, soft fail during local development
warnings.warn("You need to install the development version of pandas")
if pd.compat.is_ci_environment():
sys.exit(1)
else:
sys.exit(0)

# GH 48260
if "dev" not in pd_version:
warnings.warn(
f"stubtest may fail as {pd_version} is not a dev version. "
f"Please install a pandas dev version or see https://pandas.pydata.org/"
f"pandas-docs/stable/development/contributing_codebase.html"
f"#validating-type-hints on how to skip the stubtest"
)


_ALLOWLIST = [ # should be empty
# TODO (child classes implement these methods)
Expand Down

0 comments on commit 9757d1f

Please sign in to comment.