Browse Source

pytest: Actually make sure that the direcory exists

Some tests may not spawn a node at all, so make sure that our assumption that
the directory exists in the fixture cleanup is correct by creating the
directory.
travis-debug
Christian Decker 5 years ago
committed by Rusty Russell
parent
commit
24aaf73982
  1. 3
      contrib/pyln-testing/pyln/testing/fixtures.py
  2. 2
      tests/test_onion.py

3
contrib/pyln-testing/pyln/testing/fixtures.py

@ -41,6 +41,9 @@ def directory(request, test_base_dir, test_name):
directory = os.path.join(test_base_dir, "{}_{}".format(test_name, __attempts[test_name]))
request.node.has_errors = False
if not os.path.exists(directory):
os.makedirs(directory)
yield directory
# This uses the status set in conftest.pytest_runtest_makereport to

2
tests/test_onion.py

@ -30,7 +30,6 @@ pubkeys = [
def test_onion(directory, oniontool):
""" Generate a 5 hop onion and then decode it.
"""
os.makedirs(directory)
tempfile = os.path.join(directory, 'onion')
out = subprocess.check_output(
[oniontool, 'generate'] + pubkeys
@ -53,7 +52,6 @@ def test_onion(directory, oniontool):
def test_rendezvous_onion(directory, oniontool):
"""Create a compressed onion, decompress it at the RV node and then forward normally.
"""
os.makedirs(directory)
tempfile = os.path.join(directory, 'onion')
out = subprocess.check_output(
[oniontool, '--rendezvous-id', pubkeys[0], 'generate'] + pubkeys

Loading…
Cancel
Save