diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3196180..58eda88 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,11 +13,9 @@ jobs: strategy: matrix: os: [ubuntu-20.04, macos-latest, windows-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] # https://bugs.python.org/issue43749 exclude: - - os: windows-latest - python-version: 3.7 - os: windows-latest python-version: 3.8 @@ -51,10 +49,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v2 with: - python-version: 3.11 + python-version: 3.12 - name: Install dependencies run: | make venv diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9d5c57b..24071aa 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,6 +12,7 @@ Unreleased_ Added ~~~~~ * (mkfs) `PR #30 `_: Add support for different FAT12 cluster sizes for filesystems up to 256MB by `@zurcher `_ / `@Microsoft `_ +* `PR #36 `_: Add Python 3.12 support by `@zurcher `_ / `@Microsoft `_ Changed ~~~~~~~ @@ -23,6 +24,11 @@ Changed - Introduce ``lazy_load`` parameter to allow restoring previous behavior - `PR #32 `_: Fix tree iteration on non-lazy load by `@zurcher `_ / `@Microsoft `_ +Removed +~~~~~~~ + +* `PR #36 `_: Drop Python 3.7 support by `@zurcher `_ / `@Microsoft `_ + 1.0.5_ - 2022-04-16 ------------------- diff --git a/pyfatfs/EightDotThree.py b/pyfatfs/EightDotThree.py index 57d0ac3..0791228 100644 --- a/pyfatfs/EightDotThree.py +++ b/pyfatfs/EightDotThree.py @@ -75,7 +75,7 @@ def set_byte_name(self, name: bytes): :param name: `bytes`: Padded (must be 11 bytes) 8dot3 name """ if not isinstance(name, bytes): - raise TypeError(f"Given parameter must be of type bytes," + raise TypeError(f"Given parameter must be of type bytes, " f"but got {type(name)} instead.") name = bytearray(name) @@ -94,7 +94,7 @@ def set_byte_name(self, name: bytes): def set_str_name(self, name: str): """Set the name as string from user input (i.e. folder creation).""" if not isinstance(name, str): - raise TypeError(f"Given parameter must be of type str," + raise TypeError(f"Given parameter must be of type str, " f"but got {type(name)} instead.") if not self.is_8dot3_conform(name, self.encoding): diff --git a/pyfatfs/FatIO.py b/pyfatfs/FatIO.py index 5947bd0..67c316e 100644 --- a/pyfatfs/FatIO.py +++ b/pyfatfs/FatIO.py @@ -57,10 +57,10 @@ def __repr__(self) -> str: ex: path="/README.txt" mode="r"> """ - return f'<{self.__class__.__name__} ' \ - f'fs={self.fs} ' \ - f'path="{self.name}" ' \ - f'mode="{self.mode}"' + return str(f'<{self.__class__.__name__} ' + f'fs={self.fs} ' + f'path="{self.name}" ' + f'mode="{self.mode}"') def seek(self, offset: int, whence: int = 0) -> int: """Seek to a given offset in the file. diff --git a/pyproject.toml b/pyproject.toml index a3ef567..c482dfc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools ~= 65.6", "setuptools_scm[toml] ~= 7.1"] +requires = ["setuptools ~= 67.8", "setuptools_scm[toml] ~= 7.1"] build-backend = "setuptools.build_meta" [project] @@ -46,7 +46,7 @@ development = [ "coveralls>=3.0.0,<4.0.0", "flake8~=5.0", "flake8-docstrings>=1.6.0,<2.0.0", - "pip-tools>=6.12.0,<7.0.0", + "pip-tools~=7.3.0", "sphinx>=4.0.3,<4.1.0", "build~=0.9", ] diff --git a/requirements/development.txt b/requirements/development.txt index 7c0cdbb..ab84029 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -69,7 +69,7 @@ packaging==22.0 # sphinx pep517==0.13.0 # via build -pip-tools==6.12.1 +pip-tools==7.3.0 # via pyfatfs (pyproject.toml) pluggy==1.0.0 # via pytest diff --git a/tests/test_PyFatFS.py b/tests/test_PyFatFS.py index a62d307..c5771e4 100644 --- a/tests/test_PyFatFS.py +++ b/tests/test_PyFatFS.py @@ -36,7 +36,17 @@ def _make_fs(fat_type: int, **kwargs) -> (PyFatBytesIOFS, BytesIO): in_memory_fs) -class TestPyFatFS16(FSTestCases, TestCase): +class PyFsCompatLayer: + """PyFilesystem2 Python 3.12 compatibility layer. + + Adds a workaround for PyFilesystem2#568: + https://github.com/PyFilesystem/pyfilesystem2/issues/568 + """ + + assertRaisesRegexp = TestCase.assertRaisesRegex + + +class TestPyFatFS16(FSTestCases, TestCase, PyFsCompatLayer): """Integration tests with PyFilesystem2 for FAT16.""" FAT_TYPE = PyFat.FAT_TYPE_FAT16 @@ -107,13 +117,13 @@ def test_writetest_truncates(self): assert self.fs.readtext(fname) == '1' * 16 -class TestPyFatFS32(TestPyFatFS16, FSTestCases, TestCase): +class TestPyFatFS32(TestPyFatFS16, FSTestCases, TestCase, PyFsCompatLayer): """Integration tests with PyFilesystem2 for FAT32.""" FAT_TYPE = PyFat.FAT_TYPE_FAT32 -class TestPyFatFS12(TestPyFatFS16, FSTestCases, TestCase): +class TestPyFatFS12(TestPyFatFS16, FSTestCases, TestCase, PyFsCompatLayer): """Test specifics of FAT12 filesystem.""" FAT_TYPE = PyFat.FAT_TYPE_FAT12