Skip to content

Commit 54a0f0d

Browse files
committed
Changes for CI tests and code clean up
1 parent 292aa96 commit 54a0f0d

14 files changed

Lines changed: 57 additions & 66 deletions

.github/workflows/test_docker.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Run tests on Fedora and Ubuntu Docker images using GIFT CORP and GIFT PPA on commit
1+
# Run tests on Fedora and Ubuntu Docker images using GIFT COPR and GIFT PPA on commit
22
name: test_docker
33
on: [push]
44
permissions: read-all
@@ -11,7 +11,7 @@ jobs:
1111
container:
1212
image: registry.fedoraproject.org/fedora:${{ matrix.version }}
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v6
1515
- name: Set up container
1616
run: |
1717
dnf install -y dnf-plugins-core langpacks-en
@@ -41,7 +41,7 @@ jobs:
4141
container:
4242
image: ubuntu:${{ matrix.version }}
4343
steps:
44-
- uses: actions/checkout@v4
44+
- uses: actions/checkout@v6
4545
- name: Set up container
4646
env:
4747
DEBIAN_FRONTEND: noninteractive

.github/workflows/test_docs.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Run docs tox tests on Ubuntu Docker images using GIFT PPA
1+
# Run docs tox tests on Ubuntu Docker images using the deadsnakes and GIFT PPAs
22
name: test_docs
33
on:
44
pull_request:
@@ -13,13 +13,11 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
include:
17-
- python-version: '3.12'
18-
toxenv: 'docs'
16+
python-version: ['3.12']
1917
container:
2018
image: ubuntu:24.04
2119
steps:
22-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@v6
2321
- name: Set up container
2422
env:
2523
DEBIAN_FRONTEND: noninteractive
@@ -41,4 +39,4 @@ jobs:
4139
env:
4240
LANG: en_US.UTF-8
4341
run: |
44-
tox -e${{ matrix.toxenv }}
42+
tox -e docs

.github/workflows/test_macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
python-version: '3.14'
1313
toxenv: 'py314'
1414
steps:
15-
- uses: actions/checkout@v5
15+
- uses: actions/checkout@v6
1616
- name: Install dependencies
1717
run: |
1818
brew update -q

.github/workflows/test_tox.yml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Run tox tests on Ubuntu Docker images using GIFT PPA
1+
# Run tox tests on Ubuntu Docker images using the deadsnakes and GIFT PPAs
22
name: test_tox
33
on:
44
pull_request:
@@ -15,19 +15,19 @@ jobs:
1515
matrix:
1616
include:
1717
- python-version: '3.10'
18-
toxenv: 'py310,wheel'
18+
toxenv: 'py310'
1919
- python-version: '3.11'
20-
toxenv: 'py311,wheel'
20+
toxenv: 'py311'
2121
- python-version: '3.12'
22-
toxenv: 'py312,wheel'
22+
toxenv: 'py312'
2323
- python-version: '3.13'
24-
toxenv: 'py313,wheel'
24+
toxenv: 'py313'
2525
- python-version: '3.14'
26-
toxenv: 'py314,wheel'
26+
toxenv: 'py314'
2727
container:
2828
image: ubuntu:24.04
2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v6
3131
- name: Set up container
3232
env:
3333
DEBIAN_FRONTEND: noninteractive
@@ -49,18 +49,16 @@ jobs:
4949
env:
5050
LANG: en_US.UTF-8
5151
run: |
52-
tox -e${{ matrix.toxenv }}
52+
tox -e ${{ matrix.toxenv }},wheel
5353
coverage:
5454
runs-on: ubuntu-latest
5555
strategy:
5656
matrix:
57-
include:
58-
- python-version: '3.12'
59-
toxenv: 'coverage'
57+
python-version: ['3.12']
6058
container:
6159
image: ubuntu:24.04
6260
steps:
63-
- uses: actions/checkout@v4
61+
- uses: actions/checkout@v6
6462
- name: Set up container
6563
env:
6664
DEBIAN_FRONTEND: noninteractive
@@ -77,27 +75,25 @@ jobs:
7775
add-apt-repository -y ppa:deadsnakes/ppa
7876
add-apt-repository -y ppa:gift/dev
7977
apt-get update -q
80-
apt-get install -y build-essential git libffi-dev pkg-config python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libcaes-python3 libcreg-python3 libewf-python3 libexe-python3 libfcrypto-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libfwps-python3 libfwsi-python3 libhmac-python3 libluksde-python3 libmodi-python3 libphdi-python3 libqcow-python3 libregf-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsapm-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 libwrc-python3 python3-acstore python3-artifacts python3-cffi-backend python3-dfdatetime python3-dfimagetools python3-dfvfs python3-dfwinreg python3-dtfabric python3-idna python3-pip python3-pytsk3 python3-setuptools python3-xattr python3-yaml tox
78+
apt-get install -y build-essential curl git libffi-dev pkg-config python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libcaes-python3 libcreg-python3 libewf-python3 libexe-python3 libfcrypto-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libfwps-python3 libfwsi-python3 libhmac-python3 libluksde-python3 libmodi-python3 libphdi-python3 libqcow-python3 libregf-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsapm-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 libwrc-python3 python3-acstore python3-artifacts python3-cffi-backend python3-dfdatetime python3-dfimagetools python3-dfvfs python3-dfwinreg python3-dtfabric python3-idna python3-pip python3-pytsk3 python3-setuptools python3-xattr python3-yaml tox
8179
- name: Run tests with coverage
8280
env:
8381
LANG: en_US.UTF-8
8482
run: |
85-
tox -e${{ matrix.toxenv }}
83+
tox -e coverage
8684
- name: Upload coverage report to Codecov
87-
uses: codecov/codecov-action@v4
85+
uses: codecov/codecov-action@v6
8886
with:
8987
token: ${{ secrets.CODECOV_TOKEN }}
9088
lint:
9189
runs-on: ubuntu-latest
9290
strategy:
9391
matrix:
94-
include:
95-
- python-version: '3.12'
96-
toxenv: 'lint'
92+
python-version: ['3.12']
9793
container:
9894
image: ubuntu:24.04
9995
steps:
100-
- uses: actions/checkout@v4
96+
- uses: actions/checkout@v6
10197
- name: Set up container
10298
env:
10399
DEBIAN_FRONTEND: noninteractive
@@ -119,4 +115,4 @@ jobs:
119115
env:
120116
LANG: en_US.UTF-8
121117
run: |
122-
tox -e${{ matrix.toxenv }}
118+
tox -e lint

.pylintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ confidence=HIGH,
449449
# --disable=W".
450450
disable=assignment-from-none,
451451
bad-inline-option,
452-
consider-using-f-string,
453452
deprecated-pragma,
454453
duplicate-code,
455454
file-ignored,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "winshlrc"
7-
version = "20260501"
7+
version = "20260506"
88
description = "Windows Shell resources (winshlrc)"
99
maintainers = [
1010
{ name = "Joachim Metz", email = "joachim.metz@gmail.com" },

tests/resource_file.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def get_resource_by_identifier(self, identifier):
114114
Returns:
115115
object: resource or None.
116116
"""
117-
return self.resources.get(identifier, None)
117+
return self.resources.get(identifier)
118118

119119
def get_resource_by_name(self, name):
120120
"""Retrieves a specific resource by name.
@@ -125,7 +125,7 @@ def get_resource_by_name(self, name):
125125
Returns:
126126
object: resource or None.
127127
"""
128-
return self.resources.get(name, None)
128+
return self.resources.get(name)
129129

130130

131131
class WindowsResourceFileTest(test_lib.BaseTestCase):
@@ -342,7 +342,7 @@ def testOpenFileObjectAndCloseNoWrc(self):
342342
with open(test_file_path, 'rb') as file_object:
343343
windows_resource_file.OpenFileObject(file_object)
344344

345-
with self.assertRaises(IOError):
345+
with self.assertRaises(OSError):
346346
windows_resource_file.OpenFileObject(file_object)
347347

348348
windows_resource_file.Close()
@@ -358,7 +358,7 @@ def testOpenFileObjectAndCloseWrc(self):
358358
with open(test_file_path, 'rb') as file_object:
359359
windows_resource_file.OpenFileObject(file_object)
360360

361-
with self.assertRaises(IOError):
361+
with self.assertRaises(OSError):
362362
windows_resource_file.OpenFileObject(file_object)
363363

364364
windows_resource_file.Close()

winshlrc/extractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ def _OpenWindowsResourceFileByPathSpec(self, path_spec):
353353

354354
try:
355355
file_object = dfvfs_resolver.Resolver.OpenFileObject(path_spec)
356-
except IOError as exception:
356+
except OSError as exception:
357357
logging.warning(
358358
f'Unable to open: {path_spec.comparable:s} with error: {exception!s}')
359359
file_object = None

winshlrc/resource_file.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,10 @@ def Close(self):
128128
"""Closes the Windows Resource file.
129129
130130
Raises:
131-
IOError: if not open.
132131
OSError: if not open.
133132
"""
134133
if not self._is_open:
135-
raise IOError('Not opened.')
134+
raise OSError('Not opened.')
136135

137136
if self._exe_section:
138137
self._wrc_stream.close()
@@ -208,7 +207,7 @@ def HasStringTableResource(self):
208207
try:
209208
wrc_resource = self._wrc_stream.get_resource_by_identifier(
210209
self._STRING_TABLE_RESOURCE_IDENTIFIER)
211-
except IOError:
210+
except OSError:
212211
pass
213212

214213
return bool(wrc_resource)
@@ -220,11 +219,10 @@ def OpenFileObject(self, file_object):
220219
file_object (file): file-like object.
221220
222221
Raises:
223-
IOError: if already open.
224222
OSError: if already open.
225223
"""
226224
if self._is_open:
227-
raise IOError('Already open.')
225+
raise OSError('Already open.')
228226

229227
self._exe_file.open_file_object(file_object)
230228
self._exe_section = self._exe_file.get_section_by_name('.rsrc')

winshlrc/scripts/extract.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def Main():
113113
windows_version = source_definition['windows_version']
114114

115115
for shell_folder in extractor_object.CollectShellFolders():
116-
existing_shell_folder = shell_folders.get(shell_folder.identifier, None)
116+
existing_shell_folder = shell_folders.get(shell_folder.identifier)
117117

118118
if not existing_shell_folder:
119119
shell_folders[shell_folder.identifier] = shell_folder

0 commit comments

Comments
 (0)