Skip to content

Commit

Permalink
Merge pull request #83 from uktrade/feat/support-python-3.6
Browse files Browse the repository at this point in the history
feat: support Python 3.6.7 onwards
  • Loading branch information
michalc authored Aug 5, 2023
2 parents d439d2a + 0e5c755 commit 1bc09db
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 46 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,16 @@ jobs:
strategy:
matrix:
include:
# 3.7.1 is the earliest Python version available in actions/setup-python
- python-version: "3.6.7"
os: "ubuntu-20.04"
- python-version: "3.7.1"
os: "ubuntu-20.04"
- python-version: "3.7"
os: "ubuntu-latest"
- python-version: "3.8.0"
os: "ubuntu-20.04"
- python-version: "3.8"
os: "ubuntu-latest"
- python-version: "3.9.0"
os: "ubuntu-20.04"
- python-version: "3.9"
os: "ubuntu-latest"
- python-version: "3.10.0"
os: "ubuntu-20.04"
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout"
Expand Down Expand Up @@ -85,5 +82,5 @@ jobs:
run: |
ls -R
chmod +x ./reporter/cc-test-reporter
./reporter/cc-test-reporter sum-coverage ./coverage/*.json -p 6
./reporter/cc-test-reporter sum-coverage ./coverage/*.json -p 5
./reporter/cc-test-reporter upload-coverage
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Prerequisites

Python 3.7+
Python 3.6.7+


## Installation
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = [
]
description = "Python function to construct a ZIP archive with stream processing - without having to store the entire ZIP in memory or disk"
readme = "README.md"
requires-python = ">=3.7.1"
requires-python = ">=3.6.7"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
Expand All @@ -20,13 +20,13 @@ classifiers = [
[project.optional-dependencies]
dev = [
"coverage>=6.2",
"pytest>=7.2.0",
"pytest>=6.2.5",
"pytest-cov>=3.0.0",
"stream-unzip>=0.0.86"
]
ci = [
"coverage==6.2",
"pytest==7.2.0",
"pytest==6.2.5",
"pytest-cov==3.0.0",
"stream-unzip==0.0.86"
]
Expand Down
68 changes: 34 additions & 34 deletions test_stream_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def gen_bytes(num):


def test_with_stream_unzip_zip_64():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -62,7 +62,7 @@ def files():


def test_with_stream_unzip_zip_32():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -76,7 +76,7 @@ def files():


def test_with_stream_unzip_zip_32_and_zip_64():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -90,7 +90,7 @@ def files():


def test_with_stream_unzip_with_no_compresion_32():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -111,7 +111,7 @@ def files():
],
)
def test_with_stream_unzip_with_no_compresion_known_crc_32(method):
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -132,7 +132,7 @@ def files():
],
)
def test_with_stream_unzip_with_no_compresion_bad_crc_32(method):
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -152,7 +152,7 @@ def files():
],
)
def test_with_stream_unzip_with_no_compresion_bad_size(method):
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -165,7 +165,7 @@ def files():


def test_with_stream_unzip_auto_small():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -186,7 +186,7 @@ def files():
],
)
def test_with_stream_unzip_at_zip_32_limit(level):
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -206,7 +206,7 @@ def files():
],
)
def test_with_stream_unzip_above_zip_32_size_limit(level):
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -222,7 +222,7 @@ def files():


def test_with_stream_unzip_above_zip_32_offset_limit():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand Down Expand Up @@ -254,7 +254,7 @@ def files():


def test_with_stream_unzip_large_easily_compressible():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600
batch = b'-' * 500000

Expand All @@ -274,7 +274,7 @@ def data():


def test_with_stream_unzip_large_not_easily_compressible_with_no_compression_64():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600
batch = os.urandom(500000)

Expand All @@ -295,7 +295,7 @@ def data():


def test_with_stream_unzip_large_not_easily_compressible_with_no_compression_32():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600
batch = os.urandom(500000)

Expand All @@ -314,7 +314,7 @@ def data():


def test_with_stream_unzip_large_not_easily_compressible_with_zip_32():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = 0o600
batch = os.urandom(500000)

Expand All @@ -333,7 +333,7 @@ def data():


def test_zip_overflow_large_not_easily_compressible():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600
batch = os.urandom(500000)

Expand All @@ -350,7 +350,7 @@ def data():


def test_zip_overflow_large_easily_compressible():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600
batch = b'-' * 1000000

Expand All @@ -367,7 +367,7 @@ def data():


def test_with_zipfile_zip_64():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand Down Expand Up @@ -402,7 +402,7 @@ def extracted():


def test_with_zipfile_zip_32():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand Down Expand Up @@ -437,7 +437,7 @@ def extracted():


def test_with_zipfile_zip_32_and_zip_64():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand Down Expand Up @@ -472,7 +472,7 @@ def extracted():


def test_with_zipfile_without_compression():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand Down Expand Up @@ -507,7 +507,7 @@ def extracted():


def test_with_zipfile_many_files_zip_64():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -533,7 +533,7 @@ def extracted():


def test_too_many_files_for_zip_32_raises_exception_in_zip_32_mode():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -546,7 +546,7 @@ def files():


def test_too_many_files_for_zip_32_no_exception_in_auto_mode():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -563,7 +563,7 @@ def files():


def test_central_directory_size_overflow():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -576,7 +576,7 @@ def files():


def test_directory_zipfile():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand Down Expand Up @@ -611,7 +611,7 @@ def extracted():


def test_with_unzip_zip64():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand Down Expand Up @@ -640,7 +640,7 @@ def extracted():


def test_with_unzip_zip_32_and_zip_64():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand Down Expand Up @@ -669,7 +669,7 @@ def extracted():


def test_with_unzip_with_no_compression_32():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand Down Expand Up @@ -698,7 +698,7 @@ def extracted():


def test_name_length_overflow():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -710,7 +710,7 @@ def files():


def test_exception_propagates():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -723,7 +723,7 @@ def files():


def test_exception_from_bytes_propagates():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def data():
Expand All @@ -739,7 +739,7 @@ def files():


def test_chunk_sizes():
now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600

def files():
Expand All @@ -764,7 +764,7 @@ def get_sizes():
def test_bsdcpio(method):
assert method in (ZIP_32, ZIP_64) # Paranoia check that parameterisation works

now = datetime.fromisoformat('2021-01-01 21:01:12')
now = datetime.strptime('2021-01-01 21:01:12', '%Y-%m-%d %H:%M:%S')
mode = stat.S_IFREG | 0o600
zip_bytes = b''.join(stream_zip((
('file-1', now, mode, method, (b'contents',)),
Expand Down

0 comments on commit 1bc09db

Please sign in to comment.