Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasgriffin committed May 16, 2024
1 parent 23c18dc commit 2da4139
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 9 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,17 @@ jobs:
with:
python-version: '3.10'

- name: Install Xvfb and dependencies
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y xvfb libegl1-mesa
- name: Install dependencies
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Run tests
run: |
Xvfb :99 -screen 0 1920x1080x24 &
sleep 3 # Give Xvfb a moment to start
export DISPLAY=:99
poetry run pytest -vvv --log-cli-level=DEBUG --maxfail=1
poetry run pytest -vvv --log-cli-level=DEBUG --setup-show --maxfail=1
2 changes: 1 addition & 1 deletion bitcoin_safe/signature_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def __init__(
) -> None:
self.list_of_known_keys = list_of_known_keys if list_of_known_keys else []
self._gpg = None
self.import_known_keys()

@staticmethod
def _get_gpg_path() -> Optional[str]:
Expand Down Expand Up @@ -171,7 +172,6 @@ def gpg(self):
raise EnvironmentError("GnuPG is not installed on this system.")

def import_known_keys(self) -> None:
self.gpg()
for key in self.list_of_known_keys:
self.gpg.import_keys(key.key)

Expand Down
28 changes: 27 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ python-gnupg = "^0.5.2"
translate-toolkit = "^3.12.2"
snakeviz = "^2.2.0"
pyprof2calltree = "^1.4.5"
pytest-xvfb = "^3.0.0"

[tool.briefcase.app.bitcoin-safe.macOS]
universal_build = true
Expand Down
9 changes: 8 additions & 1 deletion tests/test_signers.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,36 +228,43 @@ def gen_multisig_descriptor_str(


def pytest_bdk_setup_single_sig(network=bdk.Network.REGTEST) -> PyTestBDKSetup:

logger.debug("pytest_bdk_setup_single_sig start")
blockchain_config = get_blockchain_config(network=network)
logger.debug(f"blockchain_config = {blockchain_config}")

blockchain = bdk.Blockchain(blockchain_config)
logger.debug(f"blockchain = {blockchain}")

mnemonic = bdk.Mnemonic.from_string(test_seeds[0])
logger.debug(f"mnemonic = {mnemonic}")

descriptor = bdk.Descriptor.new_bip84(
secret_key=bdk.DescriptorSecretKey(network, mnemonic, ""),
keychain=bdk.KeychainKind.EXTERNAL,
network=network,
)
logger.debug(f"descriptor = {descriptor}")

wallet = bdk.Wallet(
descriptor=descriptor,
change_descriptor=None,
network=network,
database_config=bdk.DatabaseConfig.MEMORY(),
)
logger.debug(f"wallet = {wallet}")

return PyTestBDKSetup(network=network, blockchain=blockchain, descriptors=[descriptor], wallets=[wallet])


@pytest.fixture
def pytest_2_of_3_multisig_wallets() -> PyTestBDKSetup:
logger.debug("prepare fixture pytest_2_of_3_multisig_wallets")
return pytest_bdk_setup_multisig(m=2, n=3, network=bdk.Network.REGTEST)


@pytest.fixture
def pytest_siglesig_wallet() -> PyTestBDKSetup:
logger.debug("prepare fixture pytest_siglesig_wallet")
return pytest_bdk_setup_single_sig(network=bdk.Network.REGTEST)


Expand Down

0 comments on commit 2da4139

Please sign in to comment.