Fix Ruff rule B027 and B024 #21272
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Github action definitions for unit-tests with PRs. | |
name: tfx-unit-tests | |
on: | |
push: | |
pull_request: | |
branches: [ master ] | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
workflow_dispatch: | |
env: | |
USE_BAZEL_VERSION: "6.5.0" | |
# Changed to match tensorflow | |
# https://github.com/tensorflow/tensorflow/blob/master/.bazelversion | |
jobs: | |
tests: | |
if: github.actor != 'copybara-service[bot]' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.9', '3.10'] | |
which-tests: ["not e2e", "e2e"] | |
dependency-selector: ["NIGHTLY", "DEFAULT"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: | | |
setup.py | |
tfx/dependencies.py | |
- name: Set up Bazel | |
uses: bazel-contrib/[email protected] | |
with: | |
# Avoid downloading Bazel every time. | |
bazelisk-cache: true | |
# Store build cache per workflow. | |
disk-cache: ${{ github.workflow }}-${{ hashFiles('.github/workflows/ci-test.yml') }} | |
# Share repository cache between workflows. | |
repository-cache: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip wheel | |
# TODO(b/232490018): Cython need to be installed separately to build pycocotools. | |
python -m pip install Cython -c ./test_constraints.txt | |
pip install \ | |
-c ./${{ matrix.dependency-selector == 'NIGHTLY' && 'nightly_test_constraints.txt' || 'test_constraints.txt' }} \ | |
--extra-index-url https://pypi-nightly.tensorflow.org/simple --pre .[all] | |
env: | |
TFX_DEPENDENCY_SELECTOR: ${{ matrix.dependency-selector }} | |
- name: Run unit tests | |
shell: bash | |
run: | | |
pytest -m "${{ matrix.which-tests }}" |