Skip to content

Commit

Permalink
Merge pull request #48 from nicoddemus/expose-timeout-async-tester
Browse files Browse the repository at this point in the history
New AsyncTester.timeout_s to control the timeout for start_and_wait()
  • Loading branch information
nicoddemus authored Oct 4, 2023
2 parents 7f2b392 + c386b48 commit cddbe35
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
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

0 comments on commit cddbe35

Please sign in to comment.