Skip to content

Commit 0d2ffa1

Browse files
authored
Merge pull request #273 from plotly/andrew/fix_testing_local_verify
Fix GHA against eager publish
2 parents e273932 + 92c6c4a commit 0d2ffa1

File tree

5 files changed

+49
-4
lines changed

5 files changed

+49
-4
lines changed

.github/workflows/publish_testpypi.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
# chrome_v: ['-1']
1717
name: Build and Test
1818
runs-on: ${{ matrix.os }}
19+
env:
20+
UV_PYTHON: ${{ matrix.python_v }}
1921
steps:
2022
- uses: actions/checkout@v4
2123
with:
@@ -28,16 +30,18 @@ jobs:
2830
# must actually checkout for version determination
2931
- run: git checkout ${{ github.ref_name }}
3032
- run: uv python install ${{ matrix.python_v }}
31-
- run: uv python pin ${{ matrix.python_v }}
32-
if: ${{ matrix.python_v != '' }}
3333
# don't modify sync file! messes up version!
3434
- run: uv sync --all-extras --locked --no-sources
35+
- run: git status
36+
- run: git diff --quiet HEAD || { echo "Working tree dirty"; exit 1; }
3537
- run: uv build
3638
- name: Reinstall from wheel
3739
run: >
3840
uv pip install dist/choreographer-$(uv
3941
run --no-sync --with setuptools-git-versioning
4042
setuptools-git-versioning)-py3-none-any.whl
43+
- run: uv run --no-sync python --version
44+
- run: uv pip freeze
4145
- run: uv run --no-sync choreo_get_chrome -v #--i ${{ matrix.chrome_v }}
4246
- name: Diagnose
4347
run: uv run --no-sync choreo_diagnose --no-run
@@ -53,18 +57,25 @@ jobs:
5357

5458
- name: Test (Debug)
5559
if: ${{ runner.debug && matrix.os != 'ubuntu-latest' }}
60+
env:
61+
CHOREO_ENABLE_DEBUG: 1
5662
run: uv run --no-sync poe debug-test
5763
timeout-minutes: 20
5864

5965
- name: Test (Debug, Linux)
6066
if: ${{ runner.debug && matrix.os == 'ubuntu-latest' }}
67+
env:
68+
CHOREO_ENABLE_DEBUG: 1
6169
run: xvfb-run uv run --no-sync poe debug-test
6270
timeout-minutes: 8
6371

6472
testpypi-publish:
6573
name: Upload release to TestPyPI
6674
needs: super-test
67-
if: ${{ !cancelled() && !failure() && github.event_name == 'push' }}
75+
if: ${{ !cancelled() &&
76+
!failure() &&
77+
github.event_name == 'push' &&
78+
github.run_attempt == 1 }}
6879
runs-on: ubuntu-latest
6980
environment:
7081
name: testpypi
@@ -80,7 +91,7 @@ jobs:
8091
with:
8192
python-version-file: "pyproject.toml"
8293
- run: git checkout ${{ github.ref_name }}
83-
- run: uv sync --frozen --all-extras
94+
- run: uv sync --locked --all-extras --no-sources
8495
- run: uv build
8596
- name: Publish package distributions to PyPI
8697
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ jobs:
4242

4343
- name: Test (Debug)
4444
if: ${{ runner.debug && matrix.os != 'ubuntu-latest' }}
45+
env:
46+
CHOREO_ENABLE_DEBUG: 1
4547
run: uv run --no-sources poe debug-test
4648
timeout-minutes: 20
4749

4850
- name: Test (Debug, Linux)
4951
if: ${{ runner.debug && matrix.os == 'ubuntu-latest' }}
52+
env:
53+
CHOREO_ENABLE_DEBUG: 1
5054
run: xvfb-run uv run --no-sources poe debug-test
5155
timeout-minutes: 7

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ ignore = [
107107
[tool.pytest.ini_options]
108108
asyncio_default_fixture_loop_scope = "function"
109109
log_cli = false
110+
addopts = "--import-mode=append"
111+
112+
[tool.poe]
113+
executor.type = "virtualenv"
110114

111115
[tool.poe.tasks]
112116
test_proc = "pytest --log-level=1 -W error -n auto -v -rfE --capture=fd tests/test_process.py"

src/choreographer/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
See the main README for a quickstart.
99
"""
1010

11+
import os
12+
13+
if os.getenv("CHOREO_ENABLE_DEBUG"):
14+
import sys
15+
16+
import logistro
17+
18+
logistro.betterConfig(level=1)
19+
print("DEBUG MODE!", file=sys.stderr) # noqa: T201
20+
1121
from .browser_async import (
1222
Browser,
1323
Tab,

tests/test_browser_search.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import os
22
import platform
33
import stat
4+
import sys
45
from pathlib import Path
56

67
import pytest
8+
79
from choreographer.browsers import chromium
10+
from choreographer.cli._cli_utils import get_chrome_download_path
811

912

1013
def test_internal(tmp_path):
@@ -29,3 +32,16 @@ def test_internal(tmp_path):
2932
_p.unlink()
3033

3134
os.environ["PATH"] = _o
35+
36+
37+
def test_canary():
38+
# This ensures we are finding the local install
39+
if os.getenv("TEST_SYSTEM_BROWSER"):
40+
pytest.skip("Okay, no need to test for local.")
41+
_r = chromium.Chromium.find_browser(skip_local=False, skip_typical=True)
42+
print(sys.path, file=sys.stderr)
43+
print(f"found {_r}", file=sys.stderr)
44+
print(f"download path: {get_chrome_download_path()}", file=sys.stderr)
45+
assert _r
46+
assert Path(_r) == get_chrome_download_path()
47+
# if _r != get_chrome_download_path():

0 commit comments

Comments
 (0)