-
-
Notifications
You must be signed in to change notification settings - Fork 690
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
Revamp testing and coverage via tox #2440
Conversation
90b7348
to
b7a31cf
Compare
807dd08
to
c8668bd
Compare
Here's my changes to the testbed:
- runs-on: ${{ matrix.runs-on }}
+ name: Testbed
needs: core
+ runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
backend: [ "macOS-x86_64", "macOS-arm64", "windows", "linux", "android", "iOS" ]
include:
- - pre-command:
- briefcase-run-prefix:
- briefcase-run-args:
+ - pre-command: ""
+ briefcase-run-prefix: ""
+ briefcase-run-args: ""
setup-python: true
- backend: "macOS-x86_64"
platform: "macOS"
runs-on: "macos-12"
- app-user-data-path: $HOME/Library/Application Support/org.beeware.toga.testbed
+ app-user-data-path: "$HOME/Library/Application Support/org.beeware.toga.testbed"
- backend: "macOS-arm64"
platform: "macOS"
runs-on: "macos-14"
- app-user-data-path: $HOME/Library/Application Support/org.beeware.toga.testbed
+ app-user-data-path: "$HOME/Library/Application Support/org.beeware.toga.testbed"
# We use a fixed Ubuntu version rather than `-latest` because at some point,
# `-latest` will be updated, but it will be a soft changeover, which would cause
@@ -195,7 +207,8 @@ jobs:
# work either. Blackbox is the lightest WM we've found that works.
pre-command: |
sudo apt update -y
- sudo apt install -y blackbox pkg-config python3-dev libgirepository1.0-dev libcairo2-dev gir1.2-webkit2-4.0
+ sudo apt install -y --no-install-recommends \
+ blackbox pkg-config python3-dev libgirepository1.0-dev libcairo2-dev gir1.2-webkit2-4.0
# Start Virtual X server
echo "Start X server..."
@@ -206,36 +219,41 @@ jobs:
echo "Start window manager..."
DISPLAY=:99 blackbox &
sleep 1
-
briefcase-run-prefix: 'DISPLAY=:99'
- setup-python: false # Use the system Python packages.
- app-user-data-path: $HOME/.local/share/testbed
+ setup-python: false # Use the system Python packages
+ app-user-data-path: "$HOME/.local/share/testbed"
- backend: "windows"
platform: "windows"
runs-on: "windows-latest"
- app-user-data-path: $HOME\AppData\Local\Tiberius Yak\Toga Testbed\Data
+ app-user-data-path: '$HOME\AppData\Local\Tiberius Yak\Toga Testbed\Data'
- backend: "iOS"
platform: "iOS"
runs-on: "macos-14"
- briefcase-run-args: ' -d "iPhone SE (3rd generation)"'
- app-user-data-path: $(xcrun simctl get_app_container booted org.beeware.toga.testbed data)/Documents
+ briefcase-run-args: "--device 'iPhone SE (3rd generation)'"
+ app-user-data-path: "$(xcrun simctl get_app_container booted org.beeware.toga.testbed data)/Documents"
- backend: "android"
platform: "android"
runs-on: "ubuntu-latest"
- briefcase-run-args: " -d '{\"avd\":\"beePhone\",\"skin\":\"pixel_3a\"}' --Xemulator=-no-window --Xemulator=-no-snapshot --Xemulator=-no-audio --Xemulator=-no-boot-anim --shutdown-on-exit"
+ briefcase-run-prefix: JAVA_HOME=${JAVA_HOME_17_X64}
+ briefcase-run-args: >
+ --device '{"avd":"beePhone","skin":"pixel_3a"}'
+ --Xemulator=-no-window
+ --Xemulator=-no-snapshot
+ --Xemulator=-no-audio
+ --Xemulator=-no-boot-anim
+ --shutdown-on-exit
pre-command: |
- # check if virtualization is supported...
- sudo apt install -qq --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
# allow access to KVM to run the emulator
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
steps:
- - uses: actions/checkout@v4.1.1
+ - name: Checkout
+ uses: actions/checkout@v4.1.1
with: |
Soo, a bit of a fundamental issue with trying to run multiple So, I guess either |
c8668bd
to
20a7f6d
Compare
So, I finally discovered that just doing an editable install will avoid using the |
ugh....a different Windows error from
|
20a7f6d
to
f9fe240
Compare
It seems clear at this point running these There are two primary issues with blocking support for running in parallel:
|
2c05ea2
to
c9677d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tox changes all make sense to me, AFAICT align with the basic approach in Briefcase (although there are obviously differences because of the differences in the projects).
The docstring and typo fixes are also welcome; however, from an administrative angle it would have been easier to review those separately (especially given how many of those changes there are, in conjunction with the complexity of the CI/tox config deltas). I'm happy to approve and merge this as is - it's just something to keep in mind for the future.
coverage combine | ||
coverage report --rcfile {tox_root}{/}pyproject.toml | ||
# TOGA_INSTALL_COMMAND is set to a bash command by the CI workflow | ||
# Install as editable so parallel runs don't clobber the build directory for each other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rmartin16 Is this comment left in as a reminder to edit the install command in the event parallel execution is tried again? In a vacuum, before looking back through this PR, I found it a puzzling mismatch with the command below it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tldr; comment is completely misleading and should be removed
I think the comment is vestigial. Although, that was the case even when the PR was merged....so, maybe more appropriate to say a mistake. On Linux, using tox p
seems to work fairly well with Toga. However, on Windows, it would fail more often than not because the parallel operations would be clobbering each other in a pip
build directory. Using an editable install (as in this force push) helped the problem for Windows; however, then the coverage calculation later on would cause problems with similar underlying issues and I just reverted the whole thing to normal installs....while the comment remained...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Thank you for the explanation! I came across it in the first place doing the background reading for #3086, so I can remove in the tox.ini changes there.
Changes
tox
workflows for running pytest and evaluating coveragepy
environment no longer automatically generates coveragetox -m test
ortox -m test310
tox
tox -m ci
tox -e py
tox -e py310
tox -e py-cov
ortox -e py310-cov
tox -e coverage
Notes
tox p
to run the envs in parallel but this may causes errors due to conflicts during pip package installs and moving coverage database filesCC: @HalfWhitt
PR Checklist: