Skip to content

Commit 2912aa5

Browse files
committed
optional pytest run against nightly
1 parent 1364a3c commit 2912aa5

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,7 @@ jobs:
5757

5858
- name: Install pandas-stubs and run tests on the installed stubs
5959
run: poetry run poe test_dist
60+
61+
- if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'
62+
name: Run pytest (against pandas nightly)
63+
run: poetry run poe pytest --nightly

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ script = "scripts.test:test(dist=True)"
7070

7171
[tool.poe.tasks.pytest]
7272
help = "Run pytest"
73-
script = "scripts.test.run:pytest"
73+
script = "scripts.test:pytest(nightly)"
74+
args = [{name = "nightly", positional = false, default = false, type = "boolean", required = false, help= "Use pandas nightly (off by default)"}]
7475

7576
[tool.poe.tasks.style]
7677
help = "Run pre-commit"

scripts/_job.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __rollback_job(steps: Deque[Step]):
3535
)
3636

3737

38-
def run_job(steps: List[Step]) -> None:
38+
def run_job(steps: List[Step], exit_on_failure: bool = True) -> None:
3939
"""
4040
Responsible to run steps with logs.
4141
"""
@@ -66,5 +66,5 @@ def run_job(steps: List[Step]) -> None:
6666
if not failed:
6767
__rollback_job(rollback_steps)
6868

69-
if failed:
69+
if exit_on_failure and failed:
7070
sys.exit(1)

scripts/test/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,8 @@ def stubtest(allowlist: str, check_missing: bool, nightly: bool) -> None:
4646
if nightly:
4747
steps.append(_step.nightly)
4848
run_job(steps + [stubtest])
49+
50+
51+
def pytest(nightly: bool) -> None:
52+
steps = [_step.nightly] if nightly else []
53+
run_job(steps + [_step.pytest], exit_on_failure=not nightly)

scripts/test/run.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,27 @@ def restore_src():
8181

8282

8383
def nightly_pandas():
84-
cmd = [sys.executable, "-m", "pip", "uninstall", "-y", "pandas"]
85-
subprocess.run(cmd, check=True)
8684
cmd = [
8785
sys.executable,
8886
"-m",
8987
"pip",
9088
"install",
91-
"-i",
89+
"--use-deprecated=legacy-resolver",
90+
"--upgrade",
91+
"--index-url",
9292
"https://pypi.anaconda.org/scipy-wheels-nightly/simple",
9393
"pandas",
9494
]
9595
subprocess.run(cmd, check=True)
9696

9797

9898
def released_pandas():
99-
cmd = [sys.executable, "-m", "pip", "uninstall", "-y", "pandas"]
100-
subprocess.run(cmd, check=True)
101-
cmd = [sys.executable, "-m", "pip", "install", "pandas"]
99+
# query pandas version
100+
text = Path("pyproject.toml").read_text()
101+
version_line = next(
102+
line for line in text.splitlines() if line.startswith("pandas = ")
103+
)
104+
version = version_line.split('"')[1]
105+
106+
cmd = [sys.executable, "-m", "pip", "install", f"pandas=={version}"]
102107
subprocess.run(cmd, check=True)

0 commit comments

Comments
 (0)