Commit Graph
11 Commits
Author SHA1 Message Date
Nicola Soranzo 0629908541 Fix new UP031 errors from ruff 0.4.2 2024-04-29 00:09:38 +01:00
Nicola Soranzo 053ca5198e Enable `warn_unused_ignores` mypy option 2024-04-16 01:12:58 +01:00
Nicola Soranzo 330599c70f Fixes for new errors from ruff 0.3.2 2024-03-12 11:06:57 +00:00
Nicola Soranzo 37116c39a0 Fix type annotation of code using XML etree
by adding lxml-stubs to our typecheck requirements.
2024-01-26 18:41:09 +00:00
Nicola Soranzo d543702e4b pytest-postgresql requires psycopg
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` .
2023-07-29 00:46:10 +01:00
mvdbeek 849219d45a Skip postgres unit tests from psycopg2 not installed 2023-07-29 00:46:09 +01:00
John Davis 0a20aa533d Fix unit test: process no longer in session
We don't keep the process in the session
2023-02-17 21:33:36 -05:00
Nicola Soranzo 69a3fd84f9 Add and fix type annotations 2022-07-26 23:56:33 +01:00
Nicola Soranzo 493db8669c Remove Python 2 support 2022-06-02 16:17:56 +01:00
Dannon Baker 623a5e165a Apply black formatting.
Apply isort.
2022-02-03 07:42:20 -05:00
John Chilton fe0c4ab4e2 Migrate more unit tests into galaxy-app's test suite. 2021-10-07 11:05:03 -04:00