Skip to content

Commit

Permalink
Update flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ukanga committed Jul 2, 2024
1 parent d331213 commit f99061c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 8 additions & 2 deletions onadata/apps/api/tests/viewsets/test_attachment_viewset.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
# -*- coding: utf-8 -*-
"""
Test Attachment viewsets.
"""
import os


from django.utils import timezone

from flaky import flaky

from onadata.apps.api.tests.viewsets.test_abstract_viewset import TestAbstractViewSet
from onadata.apps.api.viewsets.attachment_viewset import AttachmentViewSet
from onadata.apps.logger.import_tools import django_file
from onadata.apps.logger.models.attachment import Attachment
from onadata.apps.logger.models.instance import get_attachment_url
from onadata.apps.main.models.meta_data import MetaData
from onadata.libs.permissions import EditorRole
from onadata.libs.models.share_xform import ShareXForm
from onadata.libs.permissions import EditorRole


def attachment_url(attachment, suffix=None):
Expand All @@ -28,6 +33,7 @@ def setUp(self):

self._publish_xls_form_to_project()

@flaky(max_runs=3)
def test_retrieve_view(self):
self._submit_transport_instance_w_attachment()

Expand Down
12 changes: 3 additions & 9 deletions onadata/apps/api/tests/viewsets/test_xform_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from io import StringIO
from unittest.mock import Mock, patch
from xml.dom import Node
from defusedxml import minidom

from django.conf import settings
from django.contrib.contenttypes.models import ContentType
Expand All @@ -30,6 +29,7 @@
from django.utils.timezone import utc

import jwt
from defusedxml import minidom
from django_digest.test import DigestAuth
from flaky import flaky
from httmock import HTTMock
Expand All @@ -55,13 +55,7 @@
)
from onadata.apps.api.viewsets.project_viewset import ProjectViewSet
from onadata.apps.api.viewsets.xform_viewset import XFormViewSet
from onadata.apps.logger.models import (
Attachment,
Instance,
Project,
XForm,
EntityList,
)
from onadata.apps.logger.models import Attachment, EntityList, Instance, Project, XForm
from onadata.apps.logger.models.xform_version import XFormVersion
from onadata.apps.logger.views import delete_xform
from onadata.apps.logger.xform_instance_parser import XLSFormError
Expand Down Expand Up @@ -3567,7 +3561,7 @@ def test_failed_form_publishing_after_maximum_retries(
self.assertEqual(response.status_code, 202)
self.assertEqual(response.data, error_message)

@flaky(max_runs=8)
@flaky(max_runs=10)
def test_survey_preview_endpoint(self):
view = XFormViewSet.as_view({"post": "survey_preview", "get": "survey_preview"})

Expand Down
2 changes: 1 addition & 1 deletion onadata/apps/logger/tests/test_briefcase_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def _download_submissions(self):
mocker.head(requests_mock.ANY, content=submission_list)
self.briefcase_client.download_instances(self.xform.id_string)

@flaky(max_runs=10)
@flaky(max_runs=11)
def test_download_xform_xml(self):
"""
Download xform via briefcase api
Expand Down

0 comments on commit f99061c

Please sign in to comment.