-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pytest: Update tests to work for CLN v24.02
- Loading branch information
Showing
4 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
from .scheduler import Scheduler | ||
|
||
__all__ = [ | ||
Scheduler | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from pyln.testing.utils import NodeFactory | ||
import pytest | ||
from pyln.testing.fixtures import ( | ||
bitcoind, # noqa: F401 | ||
node_cls, # noqa: F401 | ||
test_name, # noqa: F401 | ||
executor, # noqa: F401 | ||
db_provider, # noqa: F401 | ||
jsonschemas, # noqa: F401 | ||
) | ||
|
||
|
||
class GlNodeFactory(NodeFactory): | ||
"""A temporary shim until pyln-testing learns to run multiple versions | ||
This adds the v24.02 `--developer` option, which was not required before. | ||
TODO Remove this shim onces pyln-testing learns about versions | ||
PR: https://github.com/ElementsProject/lightning/pull/7173 | ||
""" | ||
|
||
def get_node(self, options=None, *args, **kwargs): | ||
# Until pyln-testing learns to differentiate versions we need | ||
# to do this whenever we start a new node. pyln-testing v24.05 | ||
# promises to be multi-version compatible. | ||
if options is None: | ||
options = {} | ||
options["allow-deprecated-apis"] = True | ||
options["developer"] = None | ||
return NodeFactory.get_node(self, options=options, *args, **kwargs) | ||
|
||
|
||
@pytest.fixture | ||
def node_factory( | ||
request, # noqa: F811 | ||
directory, | ||
test_name, | ||
bitcoind, | ||
executor, | ||
db_provider, | ||
node_cls, | ||
jsonschemas, | ||
): | ||
nf = GlNodeFactory( | ||
request, | ||
test_name, | ||
bitcoind, | ||
executor, | ||
directory=directory, | ||
db_provider=db_provider, | ||
node_cls=node_cls, | ||
jsonschemas=jsonschemas, | ||
) | ||
|
||
yield nf | ||
nf.killall([not n.may_fail for n in nf.nodes]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters