diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 83ec105..f95aacf 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -57,7 +57,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DCOR_API_KEY: ${{ secrets.DCOR_API_KEY }} run: | - coverage run --source=dcoraid -m pytest tests + coverage run --source=dcoraid -m pytest --durations=20 tests - name: Lint with flake8 run: | flake8 --exclude _version.py . diff --git a/CHANGELOG b/CHANGELOG index d67a4d9..fff1c0e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -66,6 +66,8 @@ - tests: replace tests that required access to the `figshare-import` circle with a circle, collection, and dataset shared by a second automatically created test user + - tests: clear persistent upload jobs before and after each GUI test, + so that new main windows do not upload jobs of previous tests again 1.1.3 - enh: use `HTTPAdapter` with `urlib3`'s `Retry` to handle connection issues - enh: use `requests.Session` when caching is disabled diff --git a/tests/test_gui.py b/tests/test_gui.py index 36db55f..560a24b 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -16,6 +16,7 @@ from PyQt6.QtWidgets import QInputDialog, QMessageBox from . import common +from .conftest import cleanup_dcoraid_tasks @pytest.fixture(scope="function", autouse=True) @@ -23,6 +24,18 @@ def clear_ckan_api(): dcoraid.gui.api._CKAN_API = None +@pytest.fixture(scope="function", autouse=True) +def clear_persistent_upload_jobs(): + """Start and end every GUI test with an empty persistent job list + + Otherwise, each new main window restores (and uploads again) the + unfinished upload jobs of all previous tests. + """ + cleanup_dcoraid_tasks() + yield + cleanup_dcoraid_tasks() + + @pytest.fixture def mw(qtbot): # Always set server correctly, because there is a test that