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

New AsyncTester.timeout_s to control the timeout for start_and_wait() #48

Merged
merged 4 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,31 @@ jobs:

deploy:
runs-on: ubuntu-latest
permissions:
id-token: write # For PyPI trusted publishers.
contents: write # For release notes.

steps:
- uses: actions/checkout@v1

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build

- name: Build package
run: |
python -m build

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/[email protected]

- name: GitHub Release
uses: softprops/action-gh-release@v1
with:
user: __token__
password: ${{ secrets.pypi_token }}
files: dist/*
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.5.2
-----

- New attribute ``AsyncTester.timeout_s``, with the timeout in seconds until ``start_and_wait``
raises ``TimeoutError``.

0.4.0
-----

Expand Down
5 changes: 4 additions & 1 deletion src/qt_async_threads/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@ class AsyncTester:
runner: QtAsyncRunner
qtbot: QtBot

#: Timeout in seconds for ``QtBot.waitUntil`` during ``start_and_wait``.
timeout_s: int = 5

def _get_wait_idle_timeout(self) -> int:
"""
Return the maximum amount of time we should wait for the runner to
become idle, in ms.
"""
timeout_s = 5 # This is the default timeout from pytest-qt.
timeout_s = self.timeout_s
in_ci = os.environ.get("CI") == "true"
in_debugger = sys.gettrace() is not None
if in_debugger and not in_ci:
Expand Down