Skip to content

Commit

Permalink
split conftest.py to avoid some cyclic import
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Brulatout committed Aug 26, 2024
1 parent 2d82353 commit 7756723
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
16 changes: 0 additions & 16 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
import requests
from requests import RequestException

from consul import Consul

CONSUL_VERSIONS = ["1.16.1", "1.17.3"]

ACLConsul = collections.namedtuple("ACLConsul", ["instance", "token", "version"])
ConsulInstance = collections.namedtuple("ConsulInstance", ["container", "port", "version"])

# Create a logs directory if it doesn't exist
Expand Down Expand Up @@ -167,16 +164,3 @@ def acl_consul_instance(request):
@pytest.fixture
def consul_port(consul_instance):
return consul_instance.port, consul_instance.version


@pytest.fixture
def acl_consul(acl_consul_instance):
instance, token = acl_consul_instance
return ACLConsul(Consul(consistency="consistent", port=instance.port), token, instance.version)


@pytest.fixture
def consul_obj(consul_port):
consul_port, consul_version = consul_port
c = Consul(consistency="consistent", port=consul_port)
return c, consul_version
20 changes: 20 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import collections

import pytest

from consul import Consul

ACLConsul = collections.namedtuple("ACLConsul", ["instance", "token", "version"])


@pytest.fixture
def acl_consul(acl_consul_instance):
instance, token = acl_consul_instance
return ACLConsul(Consul(consistency="consistent", port=instance.port), token, instance.version)


@pytest.fixture
def consul_obj(consul_port):
consul_port, consul_version = consul_port
c = Consul(consistency="consistent", port=consul_port)
return c, consul_version

0 comments on commit 7756723

Please sign in to comment.