Skip to content

Commit

Permalink
Merge pull request #16483 from mvdbeek/unit_test_fixes
Browse files Browse the repository at this point in the history
[23.1] Fix up unit tests for local use
  • Loading branch information
mvdbeek committed Jul 29, 2023
2 parents e5d97e2 + e25e27b commit b09b4db
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions test/unit/app/managers/test_HistoryManager.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import time
from unittest import mock

import pytest
Expand Down Expand Up @@ -337,6 +338,9 @@ def test_most_recently_used(self):

history1 = self.history_manager.create(name="history1", user=user2)
self.trans.set_history(history1)

# sleep a tiny bit so update time for history2 is different from history1
time.sleep(0.1)
history2 = self.history_manager.create(name="history2", user=user2)

self.log("should be able to get the most recently used (updated) history for a given user")
Expand Down
12 changes: 8 additions & 4 deletions test/unit/app/queue_worker/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@

import pytest

try:
import psycopg
except ImportError:
psycopg = None

try:
import psycopg2
except ImportError:
psycopg2 = None

from galaxy.app_unittest_utils import galaxy_mock
from galaxy.util import which


def create_base_test(connection, amqp_type: str, amqp_connection: Optional[str] = None):
Expand Down Expand Up @@ -57,10 +61,10 @@ def create_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 psycopg:
pytest.skip("psycopg must be installed for postgresql_proc fixture")
if not psycopg2:
pytest.skip("psycopg2 must be installed for postgresql fixture")
pytest.skip("psycopg2 must be installed for database_app 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")
Expand Down
2 changes: 1 addition & 1 deletion test/unit/tool_util/test_tool_linters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ def test_general_valid(lint_ctx):

def test_general_valid_new_profile_fmt(lint_ctx):
tool_source = get_xml_tool_source(GENERAL_VALID_NEW_PROFILE_FMT)
run_lint(lint_ctx, general.lint_general, XmlToolSource(tool_source))
run_lint(lint_ctx, general.lint_general, tool_source)
assert "Tool defines a version [1.0+galaxy1]." in lint_ctx.valid_messages
assert "Tool specifies profile version [23.0]." in lint_ctx.valid_messages
assert "Tool defines an id [valid_id]." in lint_ctx.valid_messages
Expand Down

0 comments on commit b09b4db

Please sign in to comment.