Skip to content

Commit

Permalink
remove imports from conftest.py
Browse files Browse the repository at this point in the history
No-Issue
  • Loading branch information
chr-stian committed Jul 5, 2023
1 parent 72c602b commit cbbe8b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 4 additions & 5 deletions galaxy_ng/tests/integration/api/test_artifact_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from pkg_resources import parse_version

from galaxy_ng.tests.integration.constants import USERNAME_PUBLISHER
from ..conftest import is_hub_4_5, get_hub_version

from ..utils import (
CapturingGalaxyError,
Expand Down Expand Up @@ -52,7 +51,7 @@ def gen_name_for_invalid():

@pytest.mark.stage_health
@pytest.mark.parametrize("use_distribution", [True, False])
def test_api_publish(ansible_config, artifact, upload_artifact, use_distribution):
def test_api_publish(ansible_config, artifact, upload_artifact, use_distribution, hub_version):
"""Test the most basic, valid artifact upload via the API.
Should successfully return a task URL to get updates of the progress,
Expand All @@ -65,7 +64,7 @@ def test_api_publish(ansible_config, artifact, upload_artifact, use_distribution
# inbound repos aren't created anymore. This will create one to verify that they still
# work on legacy clients
if use_distribution:
if is_hub_4_5(ansible_config):
if parse_version(hub_version) < parse_version('4.6'):
pytest.skip("Hub version is 4.5")
admin_client = get_client(ansible_config(profile="admin"))
distros = admin_client("pulp/api/v3/distributions/ansible/"
Expand Down Expand Up @@ -371,7 +370,8 @@ def test_ansible_requires(ansible_config, upload_artifact, spec, settings):

@pytest.mark.stage_health
@pytest.mark.importer
def test_ansible_lint_exception(ansible_config, upload_artifact):
@pytest.mark.this
def test_ansible_lint_exception(ansible_config, upload_artifact, hub_version):
"""
Ensure that:
* ansible-lint runs against our uploaded collection
Expand Down Expand Up @@ -400,7 +400,6 @@ def test_ansible_lint_exception(ansible_config, upload_artifact):
log_messages = [item["message"] for item in resp["messages"]]

pattern = "Linting collection via ansible-lint" # hub 4.8, galaxy-importer 0.4.11
hub_version = get_hub_version(ansible_config)
if parse_version(hub_version) < parse_version('4.8.0dev'):
pattern = "Linting role .* via ansible-lint" # 4.7, galaxy-importer 0.4.7

Expand Down
5 changes: 5 additions & 0 deletions galaxy_ng/tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,11 @@ def get_hub_version(ansible_config):
return gc.get(gc.galaxy_root)["galaxy_ng_version"]


@pytest.fixture(scope="session")
def hub_version(ansible_config):
return get_hub_version(ansible_config)


def min_hub_version(ansible_config, spec):
version = get_hub_version(ansible_config)
return Requirement.parse(f"galaxy_ng<{spec}").specifier.contains(version)
Expand Down

0 comments on commit cbbe8b8

Please sign in to comment.