diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..2f9163b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,25 @@ +name: Run Tests + +on: [pull_request, push] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Set up Python 3.6 + uses: actions/setup-python@v1 + with: + python-version: 3.6 + - name: Versions + run: | + python3 --version + - name: Checkout Current Repo + uses: actions/checkout@v1 + with: + submodules: true + - name: Install pytest + run: pip install pytest + - name: Install locally + run: pip install . + - name: Run tests + run: pytest diff --git a/adafruit_imageload/bmp/__init__.py b/adafruit_imageload/bmp/__init__.py index 4eb9167..4136af8 100644 --- a/adafruit_imageload/bmp/__init__.py +++ b/adafruit_imageload/bmp/__init__.py @@ -52,10 +52,10 @@ def load(file, *, bitmap=None, palette=None): width = int.from_bytes(file.read(4), "little") try: height = int.from_bytes(file.read(4), "little") - except OverflowError: + except OverflowError as error: raise NotImplementedError( "Negative height BMP files are not supported on builds without longint" - ) + ) from error file.seek(0x1C) # Number of bits per pixel color_depth = int.from_bytes(file.read(2), "little") file.seek(0x1E) # Compression type