From 33774c2ff32302b54da2372f67259ffb5ca35a45 Mon Sep 17 00:00:00 2001 From: elkaboussi Date: Tue, 5 Mar 2024 01:06:13 +0100 Subject: [PATCH 1/2] fix: use pathlib for checking the size to avoid PermissionError --- bitmath/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitmath/__init__.py b/bitmath/__init__.py index 6babc18..d24ce58 100644 --- a/bitmath/__init__.py +++ b/bitmath/__init__.py @@ -1341,7 +1341,7 @@ def getsize(path, bestprefix=True, system=NIST): instances back. """ _path = os.path.realpath(path) - size_bytes = os.path.getsize(_path) + size_bytes = os.stat(_path).st_size if bestprefix: return Byte(size_bytes).best_prefix(system=system) else: From 3edf4cbe0acd5bb575b04054efd66fe9cf2c777d Mon Sep 17 00:00:00 2001 From: elkaboussi Date: Wed, 6 Mar 2024 17:31:05 +0100 Subject: [PATCH 2/2] add docker compose for testing --- Dockerfile | 7 +++++++ docker-compose.yaml | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d04164c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.6 + +COPY requirements-py3.txt requirements.txt + +RUN set -ex &&\ + apt-get update && apt-get install -y virtualenv &&\ + pip install --upgrade -r requirements.txt diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..7c510e3 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,13 @@ +--- + +version: '3.8' +services: + bitmath: + build: + context: . + dockerfile: Dockerfile + working_dir: /app + volumes: + - .:/app + command: make unittests pycodestyle pyflakes + tty: true