• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-cli / 9464772673

11 Jun 2024 11:32AM CUT coverage: 87.16% (+6.5%) from 80.617%
9464772673

push

github

web-flow
Update project to use hatch (#404)

* Update project to use hatch

- Update pre-commit, as black previous version was having issues
- Use recommended structure: https://docs.pytest.org/en/stable/explanation/goodpractices.html
- Update CI
- Add run_tests.sh script

* Fix coverage

* Fix version

* Fix module export

* Fix linting

---------

Co-authored-by: Uxio Fuentefria <6909403+Uxio0@users.noreply.github.com>

722 of 835 branches covered (86.47%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 2 files covered. (100.0%)

2326 of 2662 relevant lines covered (87.38%)

3.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.18
/src/safe_cli/operators/hw_wallets/trezor_exceptions.py
1
import functools
4✔
2

3
from trezorlib.exceptions import (
4✔
4
    Cancelled,
5
    OutdatedFirmwareError,
6
    PinException,
7
    TrezorFailure,
8
)
9
from trezorlib.transport import TransportException
4✔
10

11
from ..exceptions import HardwareWalletException
4✔
12
from .exceptions import InvalidDerivationPath
4✔
13

14

15
def raise_trezor_exception_as_hw_wallet_exception(function):
4✔
16
    @functools.wraps(function)
4✔
17
    def wrapper(*args, **kwargs):
4✔
18
        try:
4✔
19
            return function(*args, **kwargs)
4✔
20
        except TrezorFailure as e:
4✔
21
            raise HardwareWalletException(e.message)
×
22
        except OutdatedFirmwareError:
4✔
23
            raise HardwareWalletException("Trezor firmware version is not supported")
4✔
24
        except PinException:
4✔
25
            raise HardwareWalletException("Wrong PIN")
4✔
26
        except Cancelled:
4✔
27
            raise HardwareWalletException("Trezor operation was cancelled")
4✔
28
        except TransportException:
4✔
29
            raise HardwareWalletException("Trezor device is not connected")
4✔
30
        except InvalidDerivationPath as e:
×
31
            raise HardwareWalletException(e.message)
×
32

33
    return wrapper
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc