Skip to content
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

gl-testing: Cleaning imports #466

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions libs/gl-testing/gltesting/fixtures.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# Pytest fixtures
import tempfile
from .scheduler import Scheduler
from gltesting.clients import Clients, Client
from ephemeral_port_reserve import reserve
import pytest
from gltesting import certs
from gltesting.identity import Identity
import os
from pathlib import Path
import logging
import os
import sys
from pyln.testing.fixtures import bitcoind, teardown_checks, node_cls, test_name, executor, db_provider, test_base_dir, jsonschemas
from gltesting.network import node_factory
from pyln.testing.fixtures import directory as str_directory
from decimal import Decimal
from pathlib import Path

import pytest
from ephemeral_port_reserve import reserve
from gltesting import certs
from gltesting.clients import Clients
from pyln.testing.fixtures import directory as str_directory
from .scheduler import Scheduler

logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)
logging.getLogger().addHandler(logging.StreamHandler(sys.stdout))
Expand All @@ -22,7 +19,7 @@
logger = logging.getLogger(__name__)

@pytest.fixture()
def directory(str_directory : str) -> Path:
def directory(str_directory: str) -> Path:
return Path(str_directory) / "gl-testing"

@pytest.fixture()
Expand All @@ -45,7 +42,7 @@ def root_id(cert_directory):


@pytest.fixture()
def scheduler_id(root_id):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are needed, even if unused, because they build up the tree incrementally, and the dependency ensures the right execution order. I'm positive that is your problem. Fixtures with side-effects are nasty, but I don't know how to better do it.

def scheduler_id():
certs.genca("/services")
id = certs.gencert("/services/scheduler")
yield id
Expand All @@ -57,7 +54,7 @@ def users_id():


@pytest.fixture()
def nobody_id(users_id):
def nobody_id():
identity = certs.gencert("/users/nobody")
os.environ.update(
{
Expand Down
Loading