Skip to content

Fix E501 line length violations in tests/integrations/ and tests/platforms/ - #2979

Open
phyodev wants to merge 14 commits into
beeware:mainfrom
phyodev:fix-e501-tests-itg-plf
Open

Fix E501 line length violations in tests/integrations/ and tests/platforms/#2979
phyodev wants to merge 14 commits into
beeware:mainfrom
phyodev:fix-e501-tests-itg-plf

Conversation

@phyodev

@phyodev phyodev commented Aug 4, 2026

Copy link
Copy Markdown

This PR is to fix E501 errors under tests/integrations and tests/platforms

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool

Assisted-by: Gemini Plus (as Chatbot)

@mhsmith

mhsmith commented Aug 4, 2026

Copy link
Copy Markdown
Member

Originally posted by @phyodev in #2383

Let me continue this to cleanup E501 under tests/integrations and tests/platforms. Let me test and check code coverage after cleanup to align with the contribution guideline too

ruff check passes and that tests/integrations/ pass locally, while tests/platforms/linux/, tests/platforms/macOS and tests/platforms/conftest.py failures are due to running on Windows (symlink/privilege limitations)

I tested with this:
pre-commit run -a
ruff check tests/integrations tests/platforms --select E501
tox -e py -- tests/integrations/
tox -e py -- tests/platforms/

Note:
due to some limitations
tested on Windows 10, i7 12th Gen

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to tell us how you ran the test suite - you just need to run it. The tests also need to pass - and CI is currently showing problems.

A key detail in this refactor I that we need to retain readability. It's not enough to just split strings into multiple parts - the final result needs to be clear to read as well.

Consider the following:

"this is a long string"
"that runs across lines\n"
"but how many lines are there?\n"

That visually looks like 3 lines, but is actually 2. That's potentially very confusing to debug - so we need to find ways to structure the code so that ambiguity doesn't exist.

That might involve moving the test output to a standalone file, as is done in a lot of the Android/ADB integration tests.

Comment thread pyproject.toml Outdated

@mhsmith mhsmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some CI failures involving forward slash / backslash differences.

Other inline comments below:

Comment on lines +18 to +19
"Intel x86_64 Atom System Image | "
"system-images/android-31/default/x86_64\n"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines could be combined into one to maintain a consistent 2 fields per line, which would make the table readable even when wrapped.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thoughts, this should probably be exempted from the line length limit, as discussed below.

Comment thread tests/integrations/android_sdk/AndroidSDK/test_start_emulator.py Outdated
"------- | -------\n"
" system-images;android-31;default;x86_64 | 5 | "
"Intel x86_64 Atom System Image | "
"system-images/android-31/default/x86_64\n"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment on similar code above.

Comment thread tests/integrations/android_sdk/ADB/test_run.py Outdated
Comment thread tests/integrations/docker/test_Docker__x11_passthrough.py Outdated
Comment thread tests/integrations/windows_sdk/test_WindowsSDK__verify.py Outdated
Comment thread tests/integrations/xcode/test_ensure_xcode_is_installed.py Outdated
@phyodev

phyodev commented Aug 5, 2026

Copy link
Copy Markdown
Author

Thanks for your feedback. Let me review and fix my changes to align with your suggestions

@phyodev

phyodev commented Aug 5, 2026

Copy link
Copy Markdown
Author

There are some CI failures involving forward slash / backslash differences.

Other inline comments below:

Thanks for your feedback and let me fix it

@phyodev
phyodev requested a review from freakboy3742 August 5, 2026 09:25
),
(
"\x1b[32mD/libEGL : loaded /vendor/lib64/egl/libEGL_emulation.so\x1b[0m",
("\x1b[32mD/libEGL : loaded /vendor/lib64/egl/libEGL_emulation.so\x1b[0m"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary parentheses (multiple instances in this file, and other files; I won't bother marking any more).

Comment on lines +90 to +93
(
"test_case (tests.foobar.test_other.TestOtherMethods)",
True,
),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary change (multiple instances in this file).

Comment on lines +1085 to +1088
/ (
"base_path/build/first-app/android/gradle/"
"app/build/python/pip/debug/common"
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/ (
"base_path/build/first-app/android/gradle/"
"app/build/python/pip/debug/common"
)
/ "base_path/build/first-app/android/gradle"
/ "app/build/python/pip/debug/common"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‎ There are multiple instances of this in other files; I won't bother marking any more of them.

Comment on lines 39 to 41
# zip file can include a “__MACOSX” folder for
# each document that contains information about
# the file useful for Finder and will not be in the unzipped set of files

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uneven line length.

Comment on lines +100 to +103
# As a result of mocking ditto, the zip archive won't *actually* be created;
# and as a result of mocking os, it won't *actually* be deleted either - but we can
# verify that it *would* have been deleted. ditto will also be called when finalizing,
# verify that it *would* have been deleted.
# ditto will also be called when finalizing,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uneven line length.

Comment on lines 459 to 461
# Package the app without code signing.
# Use the base command's interface to ensure the full
# cleanup process is tested.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uneven line length: could probably be 2 lines if properly wrapped.

== "Ad-hoc identity. The resulting package will run but cannot be re-distributed."
adhoc.name == "Ad-hoc identity. The resulting package will run "
"but cannot be re-distributed."
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adhoc_name should be outside the parentheses, in which case the string might not even need to be split.

Comment on lines +40 to +43
(
" 0 DTDeviceKitBase "
"0x00000001288ff298 DTDKCreateNSErrorFromAMDErrorCode + 300"
),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For testing purposes, this could be reduced to only 2 stack trace entries.

Comment on lines +171 to +172
import { hooks } from "https://pyscript.net/"""
"""releases/2024.11.1/core.js";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, and all others involving HTML and CSS blocks, I think skipping the check with a noqa comment would be better.

@mhsmith

mhsmith commented Aug 5, 2026

Copy link
Copy Markdown
Member

Please don't mark conversations as resolved: let the person who started the conversation do that. Automatic resolution from accepting a suggestion is OK.

@mhsmith

mhsmith commented Aug 5, 2026

Copy link
Copy Markdown
Member

Consider the following:

"this is a long string"
"that runs across lines\n"
"but how many lines are there?\n"

That visually looks like 3 lines, but is actually 2. That's potentially very confusing to debug - so we need to find ways to structure the code so that ambiguity doesn't exist.

For multi-line strings, especially if they're structured as a table or something, maybe the best solution would be to keep it as a triple-quoted string with dedent, and exempt it from the line length check. Adding a noqa comment after the closing parenthesis would hopefully be sufficient.

@phyodev
phyodev force-pushed the fix-e501-tests-itg-plf branch 2 times, most recently from cb9f792 to cabebb8 Compare August 12, 2026 03:53
@phyodev
phyodev requested a review from mhsmith August 12, 2026 03:59
@phyodev

phyodev commented Aug 12, 2026

Copy link
Copy Markdown
Author

Consider the following:

"this is a long string"
"that runs across lines\n"
"but how many lines are there?\n"

That visually looks like 3 lines, but is actually 2. That's potentially very confusing to debug - so we need to find ways to structure the code so that ambiguity doesn't exist.

For multi-line strings, especially if they're structured as a table or something, maybe the best solution would be to keep it as a triple-quoted string with dedent, and exempt it from the line length check. Adding a noqa comment after the closing parenthesis would hopefully be sufficient.

@mhsmith Hey! I updated my changes according to your feedbacks. But I am not still merge main to my branch yet because there is some CI failures. But I believe my codes are aligned accordingly. If further more needed feel free to tell me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve E501 ignored Ruff rule

3 participants