-
Notifications
You must be signed in to change notification settings - Fork 999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[23.1] Fix up unit tests for local use #16483
Merged
Merged
Conversation
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
nsoranzo
reviewed
Jul 28, 2023
nsoranzo
reviewed
Jul 28, 2023
I see this failing about 50% of the time, and if it fails history1 and history2 have the same update time.
See https://github.com/ClearcodeHQ/pytest-postgresql#how-to-use Fix failing queue_worker unit tests when psycopg2 is installed (otherwise they are skipped): ``` $ pytest test/unit/app/queue_worker/test_database_heartbeat.py::test_database_heartbeat[postgres_app] ... _________________________________________________________________________ ERROR at setup of test_database_heartbeat[postgres_app] _________________________________________________________________________ request = <SubRequest 'database_app' for <Function test_database_heartbeat[postgres_app]>> @pytest.fixture(params=["postgres_app", "sqlite_app", "sqlite_rabbitmq_app"]) def database_app(request): if request.param == "postgres_app": if not which("initdb"): pytest.skip("initdb must be on PATH for postgresql fixture") if not psycopg2: pytest.skip("psycopg2 must be installed for postgresql fixture") if request.param == "sqlite_rabbitmq_app": if not os.environ.get("GALAXY_TEST_AMQP_INTERNAL_CONNECTION"): pytest.skip("rabbitmq tests will be skipped if GALAXY_TEST_AMQP_INTERNAL_CONNECTION env var is unset") > return request.getfixturevalue(request.param) test/unit/app/queue_worker/conftest.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .venv/lib/python3.10/site-packages/pytest_postgresql/factories/process.py:147: in postgresql_proc_fixture with DatabaseJanitor( .venv/lib/python3.10/site-packages/pytest_postgresql/janitor.py:54: in __init__ check_for_psycopg() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def check_for_psycopg() -> None: """ Function checks whether psycopg was imported. Raises ImportError if not. """ if not psycopg: > raise ImportError("No module named psycopg. Please install psycopg.") E ImportError: No module named psycopg. Please install psycopg. .venv/lib/python3.10/site-packages/pytest_postgresql/compat.py:35: ImportError ``` Also, remove check for `initdb` in PATH, because on Ubuntu it's installed in `/usr/lib/postgresql/VERSION/bin/initdb` .
nsoranzo
force-pushed
the
unit_test_fixes
branch
from
July 28, 2023 23:54
fbe8489
to
e25e27b
Compare
I've pushed my suggested fix for the psycopg/psycopg2 test skipping, hope that's OK. I've also pushed here a fix for unit/mypy test breakages due to the forward merge of #16480 . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes two little things when running unit tests locally
How to test the changes?
(Select all options that apply)
License