Skip to content

Add the concept of DB selectors #11

Add the concept of DB selectors

Add the concept of DB selectors #11

name: BQ Testing
on:
pull_request:
branches: [ main ]
jobs:
test-bigquery-magics:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout local PR of spanner-graph-notebook
- name: Checkout spanner-graph-notebook (Repo A)
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
# Step 2: Checkout python-bigquery-magics
- name: Checkout python-bigquery-magics (Repo B)
uses: actions/checkout@v4
with:
repository: googleapis/python-bigquery-magics
path: python-bigquery-magics
- name: Install and test
run: |
set -e
python -m venv venv
. venv/bin/activate
# Steps 3, 4, 5: Install test dependencies (pytest, etc.)
# We also include portpicker, which was in your original file and is
# likely required by the tests.
pip install pytest google-cloud-testutils google-cloud-bigquery-storage portpicker
# Step 1 (continued): Install spanner-graph-notebook in editable mode
# The '.' refers to the root directory, where Repo A was checked out.
pip install -e .
# Step 2 (continued): Install python-bigquery-magics in editable mode
# This installs from the 'python-bigquery-magics' subdirectory.
# pip will see that spanner-graph-notebook is already installed.
pip install -e ./python-bigquery-magics
# Prepend the required import to the test files
echo "import spanner_graphs.graph_visualization as graph_visualization" | cat - python-bigquery-magics/tests/unit/test_graph_server.py > temp && mv temp python-bigquery-magics/tests/unit/test_graph_server.py
echo "import spanner_graphs.graph_visualization as graph_visualization" | cat - python-bigquery-magics/tests/unit/bigquery/test_bigquery.py > temp && mv temp python-bigquery-magics/tests/unit/bigquery/test_bigquery.py
# Step 6: Run the tests
pytest -v python-bigquery-magics/tests/unit/test_graph_server.py python-bigquery-magics/tests/unit/bigquery/test_bigquery.py