Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify imports that are dependent on the version of Python #2249

Merged
merged 3 commits into from
Nov 28, 2023

Conversation

rmartin16
Copy link
Member

@rmartin16 rmartin16 commented Nov 28, 2023

Changes

  • For imports that are dependent on the version of Python, make that explicit and use a syntax that pyupgrade can automatically handle for Python EOLs
  • Given that pyupgrade can change imports, run it before isort runs in pre-commit
  • Installing toml package is no longer necessary to run isort in pre-commit
  • Instead of assuming knowledge about codespell's usage of TOML (such as the fact it uses the tomli package), instruct pre-commit to install the toml extra for codespell

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@rmartin16
Copy link
Member Author

Changing the default skin for the Android emulator broke the testbed tests:

I/python.stdout: =================================== FAILURES ===================================
I/python.stdout: _________________________________ test_scroll __________________________________
I/python.stdout: Traceback (most recent call last):
I/python.stdout:   File "/data/data/org.beeware.toga.testbed/files/chaquopy/AssetFinder/app/tests/widgets/test_detailedlist.py", line 107, in test_scroll
I/python.stdout:     assert probe.scroll_position == pytest.approx(
I/python.stdout: AssertionError: assert 4000.0 == 3469.5238095238096 ± 4.0e+02
I/python.stdout:   comparison failed
I/python.stdout:   Obtained: 4000.0
I/python.stdout:   Expected: 3469.5238095238096 ± 4.0e+02
I/python.stdout: _________________________________ test_scroll __________________________________
I/python.stdout: Traceback (most recent call last):
I/python.stdout:   File "/data/data/org.beeware.toga.testbed/files/chaquopy/AssetFinder/app/tests/widgets/test_table.py", line 126, in test_scroll
I/python.stdout:     assert probe.max_scroll_position > probe.height * 2
I/python.stdout: AssertionError: assert 1286.095238095238 > (1061 * 2)
I/python.stdout:  +  where 1286.095238095238 = <tests_backend.widgets.table.TableProbe object at 0x70811b283d60>.max_scroll_position
I/python.stdout:  +  and   1061 = <tests_backend.widgets.table.TableProbe object at 0x70811b283d60>.height
I/python.stdout: =========================== short test summary info ============================
I/python.stdout: FAILED tests/widgets/test_detailedlist.py::test_scroll - assert 4000.0 == 346...
I/python.stdout: FAILED tests/widgets/test_table.py::test_scroll - assert 1286.095238095238 > ...
I/python.stdout: ====== 2 failed, 328 passed, 61 skipped, 25 xfailed in 195.32s (0:03:15) =======

@rmartin16
Copy link
Member Author

I was able to resolve the testbed failures by having the AVD use pixel_3a skin again.

@rmartin16 rmartin16 marked this pull request as ready for review November 28, 2023 20:12
Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

At some point, we'll probably need to update the android tests to reflect changes in device skin; but otherwise, this all makes sense.

@freakboy3742 freakboy3742 merged commit 2db1d59 into beeware:main Nov 28, 2023
35 checks passed
@rmartin16 rmartin16 deleted the version-dependent-imports branch November 29, 2023 22:56
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.

2 participants