From ea5ad6e4b8c3afc1ad6c4312f2cb8f8941e82693 Mon Sep 17 00:00:00 2001 From: Hog Date: Fri, 17 Apr 2026 09:25:42 +0100 Subject: [PATCH 01/22] fix: reduce size of appimage by roughly 80mb by slimming down pyqt --- appimage-setup.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/appimage-setup.sh b/appimage-setup.sh index 42c971d0..b447f894 100755 --- a/appimage-setup.sh +++ b/appimage-setup.sh @@ -46,7 +46,10 @@ $PYTHON -m PyInstaller src/lufus/__main__.py \ --windowed \ --paths src \ --collect-all PyQt6 \ - --collect-all psutil \ + --import PyQt6.QtCore \ + --import PyQt6.QtGui \ + --import PyQt6.QtWidgets \ + --import PyQt6.QtSvg \ --hidden-import lufus.drives.autodetect_usb \ --hidden-import lufus.drives.states \ --add-data "src/lufus/gui:lufus/gui" \ From 84c7d54e1b5e59f96683b9c8476105e237e3424d Mon Sep 17 00:00:00 2001 From: Hog Date: Fri, 17 Apr 2026 09:27:39 +0100 Subject: [PATCH 02/22] revert last Removed specific imports for PyQt6 and added collection for psutil. --- appimage-setup.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/appimage-setup.sh b/appimage-setup.sh index b447f894..e60a874a 100755 --- a/appimage-setup.sh +++ b/appimage-setup.sh @@ -46,10 +46,7 @@ $PYTHON -m PyInstaller src/lufus/__main__.py \ --windowed \ --paths src \ --collect-all PyQt6 \ - --import PyQt6.QtCore \ - --import PyQt6.QtGui \ - --import PyQt6.QtWidgets \ - --import PyQt6.QtSvg \ + --collect-all psutil --hidden-import lufus.drives.autodetect_usb \ --hidden-import lufus.drives.states \ --add-data "src/lufus/gui:lufus/gui" \ From f886c4c0ba28755d3474664f4acccd94eee380bb Mon Sep 17 00:00:00 2001 From: Hog Date: Sun, 19 Apr 2026 13:27:43 +0100 Subject: [PATCH 03/22] Modify dependency version requirements Updated version constraints for dependencies in pyproject.toml. --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c552e2fe..6ca2895c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,12 +21,12 @@ test_sources = [ "tests", ] requires = [ - "psutil>=7.2.2", - "pyqt6>=6.10.2", + "psutil>=7.2", + "pyqt6>=6.8", "pyudev>=0.24.4", "requests", "packaging", - "platformdirs>=4.9.4" + "platformdirs>=4.2.0" ] test_requires = [ "pytest", From 9ff69575b691d65f4c2149349a577d4bd0450cfa Mon Sep 17 00:00:00 2001 From: Shaurya Date: Sun, 19 Apr 2026 18:34:48 +0530 Subject: [PATCH 04/22] Update pyproject.toml for lower dependencies in all places --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6ca2895c..1373683f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -134,10 +134,10 @@ readme = "README.md" license = {text = "MIT"} requires-python = ">=3.13" dependencies = [ - "psutil>=7.2.2", - "pyqt6>=6.10.2", + "psutil>=7.2", + "pyqt6>=6.8", "pyudev>=0.24.4", "requests", "packaging", - "platformdirs>=4.9.4" + "platformdirs>=4.2.0" ] From 890eb8e7721d51218ecbcf961b62c3b0066defe0 Mon Sep 17 00:00:00 2001 From: Hog Date: Mon, 20 Apr 2026 15:16:58 +0100 Subject: [PATCH 05/22] Bump version and update dependencies in pyproject.toml Updated version numbers and dependency requirements in pyproject.toml. --- pyproject.toml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1373683f..2db57fd6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ project_name = "Lufus" bundle = "com.github.hog185" # keep version synced with version in [project] -version = "1.0.0b1" +version = "1.0.1b1" url = "https://github.com/Hog185/Lufus" license.file = "LICENSE" author = "Hog185" @@ -22,11 +22,11 @@ test_sources = [ ] requires = [ "psutil>=7.2", - "pyqt6>=6.8", + "pyqt6>=6.8.0", "pyudev>=0.24.4", "requests", "packaging", - "platformdirs>=4.2.0" + "platformdirs>=4.2" ] test_requires = [ "pytest", @@ -61,6 +61,8 @@ system_runtime_requires = [ "exfatprogs", "e2fsprogs", "udftools", + "btrfs-progs", + "xfsprogs", ] [tool.briefcase.app.lufus.linux.system.rhel] system_requires = [ @@ -73,6 +75,9 @@ system_runtime_requires = [ "exfatprogs", "e2fsprogs", "udftools", + "hfsplus-tools", + "btrfs-progs", + "xfsprogs", ] [tool.briefcase.app.lufus.linux.system.suse] system_requires = [ @@ -86,6 +91,8 @@ system_runtime_requires = [ "exfatprogs", "e2fsprogs", "udftools", + "btrfs-progs", + "xfsprogs", ] [tool.briefcase.app.lufus.linux.system.arch] system_requires = [ @@ -98,6 +105,8 @@ system_runtime_requires = [ "exfatprogs", "e2fsprogs", "udftools", + "btrfs-progs", + "xfsprogs", ] [tool.briefcase.app.lufus.linux.appimage] manylinux = "manylinux_2_28" @@ -128,16 +137,22 @@ is_test = true [project] name = "lufus" # keep version synced with version in [tool.briefcase] -version = "1.0.0b1" +version = "1.0.1b1" description = "Physical drive imaging and formatting utility written in Python" readme = "README.md" license = {text = "MIT"} requires-python = ">=3.13" dependencies = [ - "psutil>=7.2", - "pyqt6>=6.8", + "psutil>=7.2.2", + "pyqt6>=6.10.2", "pyudev>=0.24.4", "requests", "packaging", - "platformdirs>=4.2.0" + "platformdirs>=4.9.4" ] + +[tool.ruff] +line-length = 120 + +[tool.ruff.lint] +select = ["E9", "F63", "F7", "F82"] From ceffc31f0116cda4aed44e7a7c304ffe0c9cb921 Mon Sep 17 00:00:00 2001 From: Hog Date: Mon, 20 Apr 2026 15:18:46 +0100 Subject: [PATCH 06/22] Modify dependency versions in pyproject.toml Updated version constraints for dependencies. --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2db57fd6..35d10398 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -143,12 +143,12 @@ readme = "README.md" license = {text = "MIT"} requires-python = ">=3.13" dependencies = [ - "psutil>=7.2.2", - "pyqt6>=6.10.2", + "psutil>=7.2", + "pyqt6>=6.8.0", "pyudev>=0.24.4", "requests", "packaging", - "platformdirs>=4.9.4" + "platformdirs>=4.2" ] [tool.ruff] From 0fbaa62c2132af73614e102def2a57d6085c01ff Mon Sep 17 00:00:00 2001 From: Hog Date: Mon, 20 Apr 2026 15:28:08 +0100 Subject: [PATCH 07/22] Update PyInstaller options for lufus build --- appimage-setup.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/appimage-setup.sh b/appimage-setup.sh index e60a874a..0e7b868e 100755 --- a/appimage-setup.sh +++ b/appimage-setup.sh @@ -45,8 +45,11 @@ $PYTHON -m PyInstaller src/lufus/__main__.py \ --name lufus \ --windowed \ --paths src \ - --collect-all PyQt6 \ - --collect-all psutil + --hidden-import PyQt6.QtCore \ + --hidden-import PyQt6.QtGui \ + --hidden-import PyQt6.QtWidgets \ + --hidden-import PyQt6.QtSvg \ + --collect-all psutil \ --hidden-import lufus.drives.autodetect_usb \ --hidden-import lufus.drives.states \ --add-data "src/lufus/gui:lufus/gui" \ From 09ab9a68c361965abe19f3ab33bad556a7a253b2 Mon Sep 17 00:00:00 2001 From: Shaurya Date: Wed, 29 Apr 2026 13:59:21 +0530 Subject: [PATCH 08/22] Add contribution guidelines section to README Added contribution guidelines to the README file. --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index e54516dd..424657bf 100644 --- a/README.md +++ b/README.md @@ -44,5 +44,16 @@ or `mkdocs serve` to run a dev server. [Read the documentation here (WIP)](https://splayer.4plt.ch/lufus/) ## Contributing +### Contribution Guidelines +1. All PR must be made against the dev branch by default. Any exceptions must be properly stated +2. Provide an example of your feature or screenshots of changes to the GUI wherever applicable +3. Any use of AI must be clearly stated on the PR +4. PR must be properly made with the format, issues and labels +5. Do not create multiple PRs or duplicate PRs at once +6. Follow proper PEP8 naming scheme (experimental) +7. Any known limitations must be clearly stated in the PR + +Your PR may be rejected by the maintainers for any of the reasons without prior notice. Please ping other maintainers if you think a mistake has been made. Guidelines are a subject to change. + Feedback, testing, translations, and other contributions are appreciated. Please join our Discord server to get quick support on contributing and debugging. This is an open-source project maintained by volunteers and hobbyists. Response times for issues and pull requests may vary. From b7b3dda97d77d1288b9bb0740f53c16f0236aac5 Mon Sep 17 00:00:00 2001 From: Shaurya Date: Wed, 6 May 2026 13:57:59 +0530 Subject: [PATCH 09/22] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 20 ++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 17 +++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..c60ae7eb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,20 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG]" +labels: Bug +assignees: '' +type: Bug + +--- + +**Describe the bug** + + +**To Reproduce** + + +**Expected behavior** + + +**LOG FILES** diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..e7db9191 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: Enhancement +assignees: '' +type: Feature + +--- + +**Is your feature request related to a problem? Please describe.** + + +**Describe the solution you'd like** + + +**Describe alternatives you've considered** From 8cdf95be899f9c9303f7697c09c2d5f0dc43a273 Mon Sep 17 00:00:00 2001 From: Shaurya Date: Wed, 6 May 2026 21:28:13 +0530 Subject: [PATCH 10/22] fixed error in test incomplete input was passed to a function --- tests/test_flash_windows_and_install_ventoy_fixes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_flash_windows_and_install_ventoy_fixes.py b/tests/test_flash_windows_and_install_ventoy_fixes.py index db19e268..9fbbcec8 100644 --- a/tests/test_flash_windows_and_install_ventoy_fixes.py +++ b/tests/test_flash_windows_and_install_ventoy_fixes.py @@ -47,11 +47,11 @@ class TestFlashWindowsOsErrorOnMissingIso: def test_returns_false_when_iso_does_not_exist(self, tmp_path): missing_iso = str(tmp_path / "nonexistent.iso") - result = fw_module.flash_windows("/dev/sdb", missing_iso) + result = fw_module.flash_windows("/dev/sdb", missing_iso, fw_module.PartitionScheme.SIMPLE_FAT32) assert result is False def test_returns_false_when_iso_is_a_directory(self, tmp_path): - result = fw_module.flash_windows("/dev/sdb", str(tmp_path)) + result = fw_module.flash_windows("/dev/sdb", str(tmp_path), fw_module.PartitionScheme.SIMPLE_FAT32) assert result is False class TestGetWimSizeCaseInsensitive: From e255a92e60b040f8c6e028f0da807a0572cd3ee7 Mon Sep 17 00:00:00 2001 From: Shaurya Date: Fri, 8 May 2026 14:51:41 +0530 Subject: [PATCH 11/22] added fpm job for rpm and deb --- .github/workflows/build.yml | 49 ++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 01697619..43a1af65 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,9 @@ jobs: libgl1 \ libegl1 \ libdbus-1-3 \ + ruby-dev\ + build-essential\ + rpm\ libxcb-cursor0 - name: Prepare Scripts run: | @@ -109,4 +112,48 @@ jobs: files: | Lufus-x86_64-${{ github.ref_name }}.tar.gz Lufus-x86_64-${{ github.ref_name }}.tar.gz.sha256 - append_body: true \ No newline at end of file + append_body: true + + # for fpm packages + build-fpm: + needs: build-tarball + runs-on: ubuntu-latest + permissions: + contents: write + strategy: + matrix: + pkg_type: [deb, rpm] + steps: + - uses: actions/@checkout@v4 + + - name: Set up Ruby + uses: actions/setup-ruby@v1 + with: + ruby-version: '3.2' + + - name: Install FPM + run: gem install fpm + + - name: Download tarball from release + run: | + wget https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/Lufus-x86_64-${{ github.ref_name }}.tar.gz + + - name: Build ${{ matrix.pkg_type }} Package + run: | + mkdir tmp_source && tar -xzf Lufus-x86_64-${{ github.ref_name }}.tar.gz -C tmp_source + fpm -s dir -t ${{ matrix.pkg_type }} \ + -n "Lufus" \ + -v "${{ github.ref_name }}" \ + --iteration 1 \ + --prefix /opt/lufus \ + --description "Physical drive imaging and formatting utility" \ + -C tmp_source/Lufus-x86_64-${{ github.ref_name }} . + + - name: Upload to Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.ref_name }} + files: | + *.deb + *.rpm + append_body: true From 93e2fa4c58a58cf3c07a732f180bde23f3c6b34b Mon Sep 17 00:00:00 2001 From: Shaurya Date: Fri, 8 May 2026 15:06:42 +0530 Subject: [PATCH 12/22] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 43a1af65..52ad600b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -124,7 +124,7 @@ jobs: matrix: pkg_type: [deb, rpm] steps: - - uses: actions/@checkout@v4 + - uses: actions/checkout@v4 - name: Set up Ruby uses: actions/setup-ruby@v1 From d8d847abedf399a1855e816489031b018abdaad6 Mon Sep 17 00:00:00 2001 From: Shaurya Date: Fri, 8 May 2026 15:15:59 +0530 Subject: [PATCH 13/22] Refactor mkfs call detection in test_formatting Update mkfs call detection to use Path for name extraction. --- tests/test_formatting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_formatting.py b/tests/test_formatting.py index 734da7ed..4291c852 100644 --- a/tests/test_formatting.py +++ b/tests/test_formatting.py @@ -422,9 +422,9 @@ def fake_run(cmd, check=True, **kwargs): formatting.dskformat() # Find the mkfs call (partition scheme parted calls come first) - mkfs_calls = [c for c in calls if c and c[0].startswith("mkfs")] + mkfs_calls = [c for c in calls if c and Path(c[0]).name.startswith("mkfs")] assert len(mkfs_calls) == 1, f"Expected 1 mkfs call, got: {calls}" - assert mkfs_calls[0][0] == expected_tool + assert expected_tool in mkfs_calls[0][0] def test_dskformat_calls_unexpected_for_unknown_fs(monkeypatch) -> None: From d9d6aaf09a08ce4e6f6cff0d7f21f4b003c75a93 Mon Sep 17 00:00:00 2001 From: Shaurya Date: Fri, 8 May 2026 15:22:13 +0530 Subject: [PATCH 14/22] Update test_formatting.py --- tests/test_formatting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_formatting.py b/tests/test_formatting.py index 4291c852..ce6a3d5b 100644 --- a/tests/test_formatting.py +++ b/tests/test_formatting.py @@ -438,7 +438,7 @@ def test_dskformat_calls_unexpected_for_unknown_fs(monkeypatch) -> None: def fake_unexpected(): called["unexpected"] = True - monkeypatch.setattr(formatting, "unexpected", fake_unexpected) + monkeypatch.setattr("lufus.drives.formatting.unexpected", fake_unexpected) monkeypatch.setattr(formatting.subprocess, "run", lambda *args, **kwargs: None) formatting.dskformat() From 68fec0ad02a139e42dbfe972a6939bbb8d6cec24 Mon Sep 17 00:00:00 2001 From: Shaurya Date: Fri, 8 May 2026 15:26:45 +0530 Subject: [PATCH 15/22] Add error handling for unknown filesystem types Handle unexpected filesystem types in formatting. --- src/lufus/drives/formatting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lufus/drives/formatting.py b/src/lufus/drives/formatting.py index 2077a101..8f6dd017 100644 --- a/src/lufus/drives/formatting.py +++ b/src/lufus/drives/formatting.py @@ -407,6 +407,7 @@ def _status(msg: str) -> None: else: _status(f"ERROR: Unknown fs_type={fs_type}") + unexpected() return False # Apply volume label after successful format From 459d1eaf29e80799e8482ea2c6bc405bacceef96 Mon Sep 17 00:00:00 2001 From: Shaurya Date: Fri, 8 May 2026 15:32:12 +0530 Subject: [PATCH 16/22] Refactor test cases for formatting functions Update tests to check for 'No drive node found' in logs instead of capturing output. Comment out redundant tests for clarity. --- tests/test_formatting.py | 175 +++++++++++++++++++-------------------- 1 file changed, 87 insertions(+), 88 deletions(-) diff --git a/tests/test_formatting.py b/tests/test_formatting.py index ce6a3d5b..90d1302a 100644 --- a/tests/test_formatting.py +++ b/tests/test_formatting.py @@ -360,8 +360,7 @@ def bad_run(*a, **kw): monkeypatch.setattr(formatting.subprocess, "run", bad_run) formatting.unmount() - out = capsys.readouterr() - assert out.out or out.err + assert "No drive node found" in caplog.text def test_remount_skips_subprocess_when_no_drive(monkeypatch, capsys) -> None: @@ -372,8 +371,7 @@ def bad_run(*a, **kw): monkeypatch.setattr(formatting.subprocess, "run", bad_run) formatting.remount() - out = capsys.readouterr() - assert out.out or out.err + assert "No drive node found" in caplog.text def test_unmount_issues_umount_command(monkeypatch) -> None: @@ -396,121 +394,122 @@ def test_remount_issues_mount_command(monkeypatch) -> None: assert calls and calls[0][0] == "mount" and drive in calls[0] and mount in calls[0] +# I think these are Redundant so i commented them out for now -@pytest.mark.parametrize( - ("fs_type", "expected_tool"), - [ - (0, "mkfs.ntfs"), - (1, "mkfs.vfat"), - (2, "mkfs.exfat"), - (3, "mkfs.ext4"), - ], -) -def test_dskformat_runs_expected_mkfs_command(monkeypatch, fs_type: int, expected_tool: str) -> None: - _setup_common_monkeypatch(monkeypatch) - monkeypatch.setattr(formatting.states, "currentFS", fs_type) - monkeypatch.setattr(formatting.states, "cluster_size", 0) - monkeypatch.setattr(formatting.states, "partition_scheme", 0) +# @pytest.mark.parametrize( +# ("fs_type", "expected_tool"), +# [ +# (0, "mkfs.ntfs"), +# (1, "mkfs.vfat"), +# (2, "mkfs.exfat"), +# (3, "mkfs.ext4"), +# ], +# ) +# def test_dskformat_runs_expected_mkfs_command(monkeypatch, fs_type: int, expected_tool: str) -> None: +# _setup_common_monkeypatch(monkeypatch) +# monkeypatch.setattr(formatting.states, "currentFS", fs_type) +# monkeypatch.setattr(formatting.states, "cluster_size", 0) +# monkeypatch.setattr(formatting.states, "partition_scheme", 0) - calls = [] +# calls = [] - def fake_run(cmd, check=True, **kwargs): - calls.append(cmd) +# def fake_run(cmd, check=True, **kwargs): +# calls.append(cmd) - monkeypatch.setattr(formatting.subprocess, "run", fake_run) +# monkeypatch.setattr(formatting.subprocess, "run", fake_run) - formatting.dskformat() +# formatting.dskformat() - # Find the mkfs call (partition scheme parted calls come first) - mkfs_calls = [c for c in calls if c and Path(c[0]).name.startswith("mkfs")] - assert len(mkfs_calls) == 1, f"Expected 1 mkfs call, got: {calls}" - assert expected_tool in mkfs_calls[0][0] +# # Find the mkfs call (partition scheme parted calls come first) +# mkfs_calls = [c for c in calls if c and Path(c[0]).name.startswith("mkfs")] +# assert len(mkfs_calls) == 1, f"Expected 1 mkfs call, got: {calls}" +# assert expected_tool in mkfs_calls[0][0] -def test_dskformat_calls_unexpected_for_unknown_fs(monkeypatch) -> None: - _setup_common_monkeypatch(monkeypatch) - monkeypatch.setattr(formatting.states, "currentFS", 99) - monkeypatch.setattr(formatting.states, "cluster_size", 0) - monkeypatch.setattr(formatting.states, "partition_scheme", 0) +# def test_dskformat_calls_unexpected_for_unknown_fs(monkeypatch) -> None: +# _setup_common_monkeypatch(monkeypatch) +# monkeypatch.setattr(formatting.states, "currentFS", 99) +# monkeypatch.setattr(formatting.states, "cluster_size", 0) +# monkeypatch.setattr(formatting.states, "partition_scheme", 0) - called = {"unexpected": False} +# called = {"unexpected": False} - def fake_unexpected(): - called["unexpected"] = True +# def fake_unexpected(): +# called["unexpected"] = True - monkeypatch.setattr("lufus.drives.formatting.unexpected", fake_unexpected) - monkeypatch.setattr(formatting.subprocess, "run", lambda *args, **kwargs: None) +# monkeypatch.setattr("lufus.drives.formatting.unexpected", fake_unexpected) +# monkeypatch.setattr(formatting.subprocess, "run", lambda *args, **kwargs: None) - formatting.dskformat() +# formatting.dskformat() - assert called["unexpected"] is True +# assert called["unexpected"] is True -def test_cluster_returns_tuple_even_without_usb(monkeypatch) -> None: - """cluster() must never crash — it must always return a valid 3-tuple.""" - monkeypatch.setattr(formatting.fu, "find_usb", lambda: {}) - monkeypatch.setattr(formatting.fu, "find_DN", lambda: None) - monkeypatch.setattr(formatting.states, "DN", "") +# def test_cluster_returns_tuple_even_without_usb(monkeypatch) -> None: +# """cluster() must never crash — it must always return a valid 3-tuple.""" +# monkeypatch.setattr(formatting.fu, "find_usb", lambda: {}) +# monkeypatch.setattr(formatting.fu, "find_DN", lambda: None) +# monkeypatch.setattr(formatting.states, "DN", "") - result = formatting.cluster() - assert isinstance(result, tuple) - assert len(result) == 3 - cluster1, cluster2, sector = result - assert cluster1 > 0 - assert cluster2 > 0 - assert sector == cluster1 // cluster2 +# result = formatting.cluster() +# assert isinstance(result, tuple) +# assert len(result) == 3 +# cluster1, cluster2, sector = result +# assert cluster1 > 0 +# assert cluster2 > 0 +# assert sector == cluster1 // cluster2 -def test_cluster_respects_cluster_size_state(monkeypatch) -> None: - monkeypatch.setattr(formatting.fu, "find_usb", lambda: {"/media/testuser/USB": "USB"}) - monkeypatch.setattr(formatting.fu, "find_DN", lambda: "/dev/sdb1") - monkeypatch.setattr(formatting.states, "DN", "/dev/sdb1") +# def test_cluster_respects_cluster_size_state(monkeypatch) -> None: +# monkeypatch.setattr(formatting.fu, "find_usb", lambda: {"/media/testuser/USB": "USB"}) +# monkeypatch.setattr(formatting.fu, "find_DN", lambda: "/dev/sdb1") +# monkeypatch.setattr(formatting.states, "DN", "/dev/sdb1") - monkeypatch.setattr(formatting.states, "cluster_size", 0) - c1, _, _ = formatting.cluster() - assert c1 == 4096 +# monkeypatch.setattr(formatting.states, "cluster_size", 0) +# c1, _, _ = formatting.cluster() +# assert c1 == 4096 - monkeypatch.setattr(formatting.states, "cluster_size", 1) - c1, _, _ = formatting.cluster() - assert c1 == 8192 +# monkeypatch.setattr(formatting.states, "cluster_size", 1) +# c1, _, _ = formatting.cluster() +# assert c1 == 8192 -def test_apply_partition_scheme_gpt(monkeypatch) -> None: - calls = [] - monkeypatch.setattr(formatting.subprocess, "run", lambda cmd, check=True, **kw: calls.append(cmd)) - monkeypatch.setattr(formatting.states, "partition_scheme", 0) +# def test_apply_partition_scheme_gpt(monkeypatch) -> None: +# calls = [] +# monkeypatch.setattr(formatting.subprocess, "run", lambda cmd, check=True, **kw: calls.append(cmd)) +# monkeypatch.setattr(formatting.states, "partition_scheme", 0) - formatting._apply_partition_scheme("/dev/sdb1") +# formatting._apply_partition_scheme("/dev/sdb1") - assert any("gpt" in c for c in calls) +# assert any("gpt" in c for c in calls) -def test_apply_partition_scheme_mbr(monkeypatch) -> None: - calls = [] - monkeypatch.setattr(formatting.subprocess, "run", lambda cmd, check=True, **kw: calls.append(cmd)) - monkeypatch.setattr(formatting.states, "partition_scheme", 1) +# def test_apply_partition_scheme_mbr(monkeypatch) -> None: +# calls = [] +# monkeypatch.setattr(formatting.subprocess, "run", lambda cmd, check=True, **kw: calls.append(cmd)) +# monkeypatch.setattr(formatting.states, "partition_scheme", 1) - formatting._apply_partition_scheme("/dev/sdb1") +# formatting._apply_partition_scheme("/dev/sdb1") - assert any("msdos" in c for c in calls) +# assert any("msdos" in c for c in calls) -def test_checkdevicebadblock_returns_false_when_no_drive(monkeypatch) -> None: - monkeypatch.setattr(formatting.fu, "find_usb", lambda: {}) - monkeypatch.setattr(formatting.fu, "find_DN", lambda: None) - monkeypatch.setattr(formatting.states, "DN", "") +# def test_checkdevicebadblock_returns_false_when_no_drive(monkeypatch) -> None: +# monkeypatch.setattr(formatting.fu, "find_usb", lambda: {}) +# monkeypatch.setattr(formatting.fu, "find_DN", lambda: None) +# monkeypatch.setattr(formatting.states, "DN", "") - result = formatting.checkdevicebadblock() - assert result is False +# result = formatting.checkdevicebadblock() +# assert result is False -def test_volumecustomlabel_no_drive_does_not_crash(monkeypatch) -> None: - """volumecustomlabel() should gracefully handle missing drive node.""" - monkeypatch.setattr(formatting.fu, "find_usb", lambda: {}) - monkeypatch.setattr(formatting.fu, "find_DN", lambda: None) - monkeypatch.setattr(formatting.states, "DN", "") - monkeypatch.setattr(formatting.states, "currentFS", 0) - monkeypatch.setattr(formatting.states, "new_label", "TESTLABEL") +# def test_volumecustomlabel_no_drive_does_not_crash(monkeypatch) -> None: +# """volumecustomlabel() should gracefully handle missing drive node.""" +# monkeypatch.setattr(formatting.fu, "find_usb", lambda: {}) +# monkeypatch.setattr(formatting.fu, "find_DN", lambda: None) +# monkeypatch.setattr(formatting.states, "DN", "") +# monkeypatch.setattr(formatting.states, "currentFS", 0) +# monkeypatch.setattr(formatting.states, "new_label", "TESTLABEL") - # Should not raise - formatting.volumecustomlabel() +# # Should not raise +# formatting.volumecustomlabel() From 98e12823ff8389fd15e5f2a8e779fa5605a57d47 Mon Sep 17 00:00:00 2001 From: Shaurya Date: Fri, 8 May 2026 15:36:16 +0530 Subject: [PATCH 17/22] Update test_formatting.py --- tests/test_formatting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_formatting.py b/tests/test_formatting.py index 90d1302a..39feca86 100644 --- a/tests/test_formatting.py +++ b/tests/test_formatting.py @@ -70,9 +70,9 @@ def fake_run(cmd, check=True, **kwargs): formatting.dskformat() # Find the mkfs call (partition scheme parted calls come first) - mkfs_calls = [c for c in calls if c and c[0].startswith("mkfs")] + mkfs_calls = [c for c in calls if c and Path(c[0]).name.startswith("mkfs")] assert len(mkfs_calls) == 1, f"Expected 1 mkfs call, got: {calls}" - assert mkfs_calls[0][0] == expected_tool + assert Path(mkfs_calls[0][0]).name == expected_tool def test_dskformat_calls_unexpected_for_unknown_fs(monkeypatch) -> None: From 7990a73016d60563b8bb4a3019a51bdb3eb91006 Mon Sep 17 00:00:00 2001 From: Shaurya Date: Fri, 8 May 2026 15:39:24 +0530 Subject: [PATCH 18/22] Change capsys to caplog in unmount tests --- tests/test_formatting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_formatting.py b/tests/test_formatting.py index 39feca86..a80ee7e7 100644 --- a/tests/test_formatting.py +++ b/tests/test_formatting.py @@ -352,7 +352,7 @@ def test_get_mount_and_drive_falls_back_to_find_dn(monkeypatch) -> None: # unmount / remount # --------------------------------------------------------------------------- -def test_unmount_skips_subprocess_when_no_drive(monkeypatch, capsys) -> None: +def test_unmount_skips_subprocess_when_no_drive(monkeypatch, caplog) -> None: monkeypatch.setattr(formatting, "_get_mount_and_drive", lambda: (None, None, {})) def bad_run(*a, **kw): @@ -363,7 +363,7 @@ def bad_run(*a, **kw): assert "No drive node found" in caplog.text -def test_remount_skips_subprocess_when_no_drive(monkeypatch, capsys) -> None: +def test_remount_skips_subprocess_when_no_drive(monkeypatch, caplog) -> None: monkeypatch.setattr(formatting, "_get_mount_and_drive", lambda: (None, None, {})) def bad_run(*a, **kw): From bb27c5bdf79dd6d114d02ed0366a64c243441492 Mon Sep 17 00:00:00 2001 From: Shaurya Date: Fri, 8 May 2026 15:44:28 +0530 Subject: [PATCH 19/22] Refactor unmount test assertions for clarity --- tests/test_formatting.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_formatting.py b/tests/test_formatting.py index a80ee7e7..6a2e873d 100644 --- a/tests/test_formatting.py +++ b/tests/test_formatting.py @@ -378,10 +378,14 @@ def test_unmount_issues_umount_command(monkeypatch) -> None: mount = "/media/testuser/USB" drive = "/dev/sdb1" monkeypatch.setattr(formatting, "_get_mount_and_drive", lambda: (mount, drive, {})) + monkeypatch.setattr(formatting.glob, "glob", lambda path: [drive]) calls = [] monkeypatch.setattr(formatting.subprocess, "run", lambda cmd, *a, **kw: calls.append(cmd)) + monkeypatch.setattr(formatting.time, "sleep", lambda x: None) formatting.unmount() - assert calls and calls[0][0] == "umount" and drive in calls[0] + assert any("umount" in cmd for cmd in calls), f"umount not found in {calls}" + assert any(drive in cmd for cmd in calls) + assert calls[-1] == ["udevadm", "settle"] def test_remount_issues_mount_command(monkeypatch) -> None: From 66b42c8323e00439ab5bcda84565eb692cef2342 Mon Sep 17 00:00:00 2001 From: Shaurya Date: Sat, 9 May 2026 12:49:02 +0530 Subject: [PATCH 20/22] Update pyproject.toml --- pyproject.toml | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c87ef248..ce646dc2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,12 +30,7 @@ lufus = "lufus.__main__:main" [tool.briefcase] project_name = "Lufus" bundle = "com.github.hog185" -<<<<<<< HEAD version = "1.0.0" # keep synced with [project] version -======= -# keep version synced with version in [project] -version = "1.0.1b1" ->>>>>>> e668f6b010fc6bf72b2d1a934de4bec44c9c195a url = "https://github.com/Hog185/Lufus" license.file = "LICENSE" author = "Hog185" @@ -54,19 +49,11 @@ test_sources = [ ] requires = [ "psutil>=7.2", -<<<<<<< HEAD "pyside6", # "pyqt6>=6.8.0", -======= - "pyqt6>=6.8.0", ->>>>>>> e668f6b010fc6bf72b2d1a934de4bec44c9c195a "pyudev>=0.24.4", "packaging", -<<<<<<< HEAD "platformdirs>=4.2", -======= - "platformdirs>=4.2" ->>>>>>> e668f6b010fc6bf72b2d1a934de4bec44c9c195a ] test_requires = [ "pytest", @@ -189,11 +176,11 @@ license = {text = "MIT"} requires-python = ">=3.13" dependencies = [ "psutil>=7.2", - "pyqt6>=6.8.0", + "pyside6", "pyudev>=0.24.4", "requests", "packaging", - "platformdirs>=4.2" + "platformdirs>=4.2", ] >>>>>>> e668f6b010fc6bf72b2d1a934de4bec44c9c195a From 69f92f5f607481336215fa3184ba53e43ed11821 Mon Sep 17 00:00:00 2001 From: Shaurya Singh Date: Sat, 9 May 2026 12:52:29 +0530 Subject: [PATCH 21/22] pyproject.toml typos and format fix --- pyproject.toml | 19 ------------------- tests/test_formatting.py | 4 +++- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ce646dc2..72d532d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -164,25 +164,6 @@ supported = false variant = "Alpha Testing 'FOV' Fork" commit_date = 2026-03-26 is_test = true -<<<<<<< HEAD -======= -[project] -name = "lufus" -# keep version synced with version in [tool.briefcase] -version = "1.0.1b1" -description = "Physical drive imaging and formatting utility written in Python" -readme = "README.md" -license = {text = "MIT"} -requires-python = ">=3.13" -dependencies = [ - "psutil>=7.2", - "pyside6", - "pyudev>=0.24.4", - "requests", - "packaging", - "platformdirs>=4.2", -] ->>>>>>> e668f6b010fc6bf72b2d1a934de4bec44c9c195a [tool.ruff] line-length = 120 diff --git a/tests/test_formatting.py b/tests/test_formatting.py index bf31292f..0c3b22b9 100644 --- a/tests/test_formatting.py +++ b/tests/test_formatting.py @@ -368,6 +368,7 @@ def test_get_mount_and_drive_falls_back_to_find_dn(monkeypatch) -> None: # unmount / remount # --------------------------------------------------------------------------- + def test_unmount_skips_subprocess_when_no_drive(monkeypatch, caplog) -> None: monkeypatch.setattr(formatting, "_get_mount_and_drive", lambda: (None, None, {})) @@ -481,7 +482,8 @@ def test_remount_issues_mount_command(monkeypatch) -> None: monkeypatch.setattr(formatting.subprocess, "run", lambda cmd, *a, **kw: calls.append(cmd)) formatting.remount() assert calls and calls[0][0] == "mount" and drive in calls[0] and mount in calls[0] - + + # I think these are Redundant so i commented them out for now # @pytest.mark.parametrize( From c4d3d8183a99ed74fd4e59d1a96a7edad615c2a4 Mon Sep 17 00:00:00 2001 From: Shaurya Singh Date: Sat, 9 May 2026 12:58:30 +0530 Subject: [PATCH 22/22] format fix --- src/lufus/drives/formatting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lufus/drives/formatting.py b/src/lufus/drives/formatting.py index 4c3913b9..643e1a4d 100644 --- a/src/lufus/drives/formatting.py +++ b/src/lufus/drives/formatting.py @@ -348,7 +348,7 @@ def _status(msg: str) -> None: if fs_type not in fs_configs: _status(f"ERROR: Unknown fs_type={fs_type}") - unexpected() + log_unexpected_error() return False tool_name, args_fn, fs_label, install_hint = fs_configs[fs_type]