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

Fix tests and related warnings #217

Merged
merged 9 commits into from
Aug 23, 2023

Conversation

lzaoral
Copy link
Contributor

@lzaoral lzaoral commented Aug 21, 2023

This PR fixes two tests, removes XFAIL for already passing tests and fixes majority of warnings emitted during testing.

Resolves: #68
Resolves: #73

The original test misunderstood the intended behaviour of this method.

Resolves: release-engineering#68
…ished test

The test was not updated for recent changes in 0d3f700.

Fixes: 0d3f700 ("tasks: make it possible to interrupt assigned tasks")
They have been passing for few years already so there is no reason to
keep them in this state forever.

Resolves: release-engineering#73
To fix the following Python 3.13 deprecation warning:
```
kobo/hub/models.py:535: DeprecationWarning: 'pipes' is deprecated and slated for removal in Python 3.13
  import pipes
```
@lzaoral lzaoral force-pushed the update-and-fix-tests branch 2 times, most recently from 134cc50 to 43db3cd Compare August 21, 2023 05:45
kobo/hub/models.py Outdated Show resolved Hide resolved
Fixes the following Django 5.0 deprecation warning:
```
tests/test_forms.py: 6 warnings
tests/test_models.py: 88 warnings
tests/test_taskmanager.py: 37 warnings
tests/test_views.py: 8 warnings
tests/test_xmlrpc_auth.py: 2 warnings
tests/test_xmlrpc_client.py: 9 warnings
tests/test_xmlrpc_worker.py: 63 warnings
  kobo/.kobo_venv/lib/python3.11/site-packages/django/db/models/fields/related_lookups.py:52: RemovedInDjango50Warning: Passing unsaved model instances to related filters is deprecated.
```
…_fatal_error

Fixes the following pytest warning:
```
tests/test_logger.py::TestLoggingThread::test_logs_on_fatal_error
  kobo/.kobo_venv/lib/python3.11/site-packages/_pytest/threadexception.py:73: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-1

  Traceback (most recent call last):
    File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
      self.run()
    File "kobo/kobo/worker/logger.py", line 67, in run
      self._hub.upload_task_log(BytesIO(self._send_data), self._task_id, "stdout.log", append=True)
    File "kobo/.kobo_venv/lib/python3.11/site-packages/mock/mock.py", line 1062, in __call__
      return _mock_self._mock_call(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "kobo/.kobo_venv/lib/python3.11/site-packages/mock/mock.py", line 1118, in _mock_call
      raise effect
  RuntimeError: Simulated error

    warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
```
Fixes the following Python deprecation warning:
```
kobo/django/django_version.py:10: 10 warnings
tests/test_view_log.py: 24 warnings
tests/test_views.py: 6 warnings
tests/test_xmlrpc_auth.py: 8 warnings
  kobo/kobo/django/django_version.py:10: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      return LooseVersion(django.get_version()) >= LooseVersion(version_str)
```
@rohanpm rohanpm merged commit ce4fcff into release-engineering:master Aug 23, 2023
15 checks passed
@lzaoral lzaoral deleted the update-and-fix-tests branch August 23, 2023 07:27
lzaoral added a commit to lzaoral/kobo that referenced this pull request Aug 23, 2023
... to ensure that the db operation is atomic.

Fixes: c5d7f8e ("Fix calculating the number of task's subtasks in new Django versions")
Related: release-engineering#217 (comment)
lzaoral added a commit to lzaoral/kobo that referenced this pull request Aug 24, 2023
... to ensure that the db operation is atomic.

Fixes: c5d7f8e ("Fix calculating the number of task's subtasks in new Django versions")
Related: release-engineering#217 (comment)
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.

Task.__lock fails on Python 3 Worker.update_worker does not update attributes
2 participants