Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

olavloite
Copy link
Contributor

@olavloite olavloite commented Oct 24, 2024

  • Updates all dependencies in one go.
  • Updates the build/test system to use Python 3.12 for the compliance tests for SQLAlchemy 2.0. As this does not work on Kokoro, the tests are only run using GitHub actions against the emulator. This also makes the tests extremely much faster.
  • Adds missing test workflows to GitHub actions to cover all types of test sessions.

TODOs in next steps:

  • Remove the compliance Kokoro job, as it currently does the same as the normal Kokoro presubmit job.
  • Remove tests for SQLAlchemy 1.3. That version is no longer supported.

@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API. label Oct 24, 2024
@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 28, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 28, 2024
@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 28, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 28, 2024
# otherwise run all the sessions.
if [[ -n "${NOX_SESSION:-}" ]]; then
python3 -m nox -s ${NOX_SESSION:-}
elif [[ "${RUN_COMPLIANCE_TESTS}" -eq "false" ]]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This ensures that if RUN_COMPLIANCE_TESTS=false has been set, then we only run the unit tests (and not lint, migration tests, etc.). All of those are covered by GitHub Actions runners.

env_vars: {
key: "NOX_SESSION"
value: "compliance_test_20"
value: "unit"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO in a next step: Remove this entire workflow. It is slow and not needed. The tests against the emulator should be enough.


if USE_EMULATOR:
database = instance.database("compliance-test")
database.drop()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This ensures that each test really gets a fresh database. SQLAlchemy just ignored AlreadyExists errors that happened when the tests tried to create the same database again on the emulator, which caused some tests to show unpredictable behavior.

Note that database.drop() is a no-op if the database does not exist.

BLACK_VERSION = "black==22.3.0"
BLACK_PATHS = ["google", "test", "noxfile.py", "setup.py", "samples"]
DEFAULT_PYTHON_VERSION = "3.8"
DEFAULT_PYTHON_VERSION_FOR_SQLALCHEMY_20 = "3.12"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Run compliance tests for SQLAlchemy 2.0 on Python 3.12. That is a currently supported version (https://devguide.python.org/versions/)

zip_safe=False,
)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes sure that the tests do not fail due to a warning about deprecation being logged.

cls.ot_exporter = get_test_ot_exporter()

def teardown(self):
def teardown_method(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@olavloite olavloite requested a review from asthamohta October 28, 2024 21:00
@olavloite olavloite merged commit 25d9d2c into main Oct 31, 2024
14 checks passed
@olavloite olavloite deleted the update-all-deps branch October 31, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants