diff --git a/.github/workflows/publish_testpypi.yml b/.github/workflows/publish_testpypi.yml index 122f9cdd..bc6caee4 100644 --- a/.github/workflows/publish_testpypi.yml +++ b/.github/workflows/publish_testpypi.yml @@ -16,6 +16,8 @@ jobs: # chrome_v: ['-1'] name: Build and Test runs-on: ${{ matrix.os }} + env: + UV_PYTHON: ${{ matrix.python_v }} steps: - uses: actions/checkout@v4 with: @@ -28,16 +30,18 @@ jobs: # must actually checkout for version determination - run: git checkout ${{ github.ref_name }} - run: uv python install ${{ matrix.python_v }} - - run: uv python pin ${{ matrix.python_v }} - if: ${{ matrix.python_v != '' }} # don't modify sync file! messes up version! - run: uv sync --all-extras --locked --no-sources + - run: git status + - run: git diff --quiet HEAD || { echo "Working tree dirty"; exit 1; } - run: uv build - name: Reinstall from wheel run: > uv pip install dist/choreographer-$(uv run --no-sync --with setuptools-git-versioning setuptools-git-versioning)-py3-none-any.whl + - run: uv run --no-sync python --version + - run: uv pip freeze - run: uv run --no-sync choreo_get_chrome -v #--i ${{ matrix.chrome_v }} - name: Diagnose run: uv run --no-sync choreo_diagnose --no-run @@ -53,18 +57,25 @@ jobs: - name: Test (Debug) if: ${{ runner.debug && matrix.os != 'ubuntu-latest' }} + env: + CHOREO_ENABLE_DEBUG: 1 run: uv run --no-sync poe debug-test timeout-minutes: 20 - name: Test (Debug, Linux) if: ${{ runner.debug && matrix.os == 'ubuntu-latest' }} + env: + CHOREO_ENABLE_DEBUG: 1 run: xvfb-run uv run --no-sync poe debug-test timeout-minutes: 8 testpypi-publish: name: Upload release to TestPyPI needs: super-test - if: ${{ !cancelled() && !failure() && github.event_name == 'push' }} + if: ${{ !cancelled() && + !failure() && + github.event_name == 'push' && + github.run_attempt == 1 }} runs-on: ubuntu-latest environment: name: testpypi @@ -80,7 +91,7 @@ jobs: with: python-version-file: "pyproject.toml" - run: git checkout ${{ github.ref_name }} - - run: uv sync --frozen --all-extras + - run: uv sync --locked --all-extras --no-sources - run: uv build - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf039c6d..31db1917 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,10 +42,14 @@ jobs: - name: Test (Debug) if: ${{ runner.debug && matrix.os != 'ubuntu-latest' }} + env: + CHOREO_ENABLE_DEBUG: 1 run: uv run --no-sources poe debug-test timeout-minutes: 20 - name: Test (Debug, Linux) if: ${{ runner.debug && matrix.os == 'ubuntu-latest' }} + env: + CHOREO_ENABLE_DEBUG: 1 run: xvfb-run uv run --no-sources poe debug-test timeout-minutes: 7 diff --git a/pyproject.toml b/pyproject.toml index 9f2f69a6..f5c293ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,6 +107,10 @@ ignore = [ [tool.pytest.ini_options] asyncio_default_fixture_loop_scope = "function" log_cli = false +addopts = "--import-mode=append" + +[tool.poe] +executor.type = "virtualenv" [tool.poe.tasks] test_proc = "pytest --log-level=1 -W error -n auto -v -rfE --capture=fd tests/test_process.py" diff --git a/src/choreographer/__init__.py b/src/choreographer/__init__.py index d57c23f1..30000ada 100644 --- a/src/choreographer/__init__.py +++ b/src/choreographer/__init__.py @@ -8,6 +8,16 @@ See the main README for a quickstart. """ +import os + +if os.getenv("CHOREO_ENABLE_DEBUG"): + import sys + + import logistro + + logistro.betterConfig(level=1) + print("DEBUG MODE!", file=sys.stderr) # noqa: T201 + from .browser_async import ( Browser, Tab, diff --git a/tests/test_browser_search.py b/tests/test_browser_search.py index 0a49ebba..c166f470 100644 --- a/tests/test_browser_search.py +++ b/tests/test_browser_search.py @@ -1,10 +1,13 @@ import os import platform import stat +import sys from pathlib import Path import pytest + from choreographer.browsers import chromium +from choreographer.cli._cli_utils import get_chrome_download_path def test_internal(tmp_path): @@ -29,3 +32,16 @@ def test_internal(tmp_path): _p.unlink() os.environ["PATH"] = _o + + +def test_canary(): + # This ensures we are finding the local install + if os.getenv("TEST_SYSTEM_BROWSER"): + pytest.skip("Okay, no need to test for local.") + _r = chromium.Chromium.find_browser(skip_local=False, skip_typical=True) + print(sys.path, file=sys.stderr) + print(f"found {_r}", file=sys.stderr) + print(f"download path: {get_chrome_download_path()}", file=sys.stderr) + assert _r + assert Path(_r) == get_chrome_download_path() + # if _r != get_chrome_download_path():