Skip to content

Conversation

@JayBazuzi
Copy link
Contributor

@JayBazuzi JayBazuzi commented Nov 10, 2024

run_tests.sh had some problems:

  • it used python ... to upgrade Pip, but python isn't guaranteed to be available. On my machine, it's python3 and I believe that is more common.
  • when any command failed, the script would keep running. This made it hard for people to notice that we were failing to upgrade Pip
  • There's no need to upgrade Pip.
  • Since we're already using Tox to manage virtual environments, we should let it manage pytest

Summary by Sourcery

Improve the run_tests.sh script by switching to python3 for pip commands, removing the pip upgrade step, and leveraging Tox for managing pytest.

Build:

  • Modify run_tests.sh to use python3 for pip installation and remove unnecessary pip upgrade.

Tests:

  • Update run_tests.sh to utilize Tox for managing pytest instead of manual installation.

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 10, 2024

Reviewer's Guide by Sourcery

The changes improve the robustness and simplicity of the test execution script by removing unnecessary dependencies and adding proper error handling. The implementation leverages Tox for managing the test environment, eliminating redundant pip installations and potential version conflicts.

Sequence diagram for the updated test execution process

sequenceDiagram
    participant Developer
    participant Script
    participant Tox

    Developer->>Script: Run run_tests.sh
    Script->>Script: Set bash options (e.g., set -euo pipefail)
    Script->>Script: Execute python3 -m pip --disable-pip-version-check install tox
    Script->>Tox: Execute tox -e py
    Tox-->>Developer: Test results
Loading

File-Level Changes

Change Details Files
Improved test script robustness and error handling
  • Added proper shebang line to ensure script execution consistency
  • Added bash safety flags (set -euo pipefail) to fail fast on errors
  • Changed python command to python3 for better compatibility
  • Removed unnecessary pip upgrade step
  • Removed direct pytest installation since it's managed by tox
  • Added --disable-pip-version-check flag to reduce unnecessary output
run_tests.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

pylint
pytest-asyncio==0.21.1 # 0.23 has a bug 2023/12/3

pytest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest is part of reqs.prod, do we still want it here?

@nitsanavni nitsanavni merged commit 861768b into approvals:main Nov 12, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants