Skip to content

Conversation

@3nprob
Copy link

@3nprob 3nprob commented May 1, 2022

#125 based on the newer async version

Depends on lndmanage:local from bitromortac/lnregtest#7

@3nprob 3nprob changed the title Docker test async Add Dockerfile with tests (async) May 1, 2022
@3nprob 3nprob force-pushed the docker-test-async branch from d200436 to d788ceb Compare May 1, 2022 14:55
from typing import List
import unittest

from test.testing_common import (
Copy link
Owner

Choose a reason for hiding this comment

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

What's your motivation for changing the order there? I usually order such that the modules that are closest to the current code are coming last.

Copy link
Author

@3nprob 3nprob May 5, 2022

Choose a reason for hiding this comment

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

Yes, so, both lndmanage.settings and test.testing_common have side-effects on import where they attempt to read/create the config file, and can error if this fails.

Before these changes, running the tests in a clean environment can fail due to this.

The idea here is that test.testing_common ensure that this does not happen by ensuring consistency and a default for LNDMANAGE_HOME. So testing_common needs to be imported before lndmanage.settings.

I think there was some discussions elsewhere on how it would be desirable to not have side-effects-by-import, which can be good to address down the line, but at least these changes (d788ceb in isolation) will ensure that the test suite doesn't interact with any existing config on the system.

Copy link
Owner

Choose a reason for hiding this comment

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

Ok, I see

import shutil
from unittest import TestCase

# testing base folder
Copy link
Owner

Choose a reason for hiding this comment

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

Also here, could you give me a hint why this is a better order for you? :)

Copy link
Author

Choose a reason for hiding this comment

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

See above - os.environ.setdefault('LNDMANAGE_HOME', lndmanage_home) and os.makedirs before importing settings.

@3nprob 3nprob force-pushed the docker-test-async branch from d788ceb to da066c8 Compare May 5, 2022 04:50
@3nprob 3nprob changed the base branch from 2204-async to master May 5, 2022 04:50
@bitromortac bitromortac merged commit 72571f0 into bitromortac:master May 6, 2022
@bitromortac
Copy link
Owner

Pretty cool work, a big step towards CI! 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants