Edgewall Software
Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#12624 closed defect (fixed)

Test failure with test_get_search_results_matches_all_terms

Reported by: Ryan J Ollos Owned by: Jun Omae
Priority: normal Milestone: 1.0.14
Component: search system Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fix a random failure with test_get_search_results_matches_all_terms.

API Changes:
Internal Changes:

Description

Here is the output from a TravisCI test failure:

======================================================================
FAIL: test_get_search_results_matches_all_terms (trac.ticket.tests.roadmap.MilestoneModuleTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/travis/build/edgewall/trac/trac/ticket/tests/roadmap.py", line 201, in test_get_search_results_matches_all_terms
    self.assertEqual(milestone.description, results[0][4])
AssertionError: u'a326e942 malapplication dyce renounce nonqualification stackful Amphion upbring defectibility theriotrophical unsanctimoniousness haemoconcentration terrine ochlocratically thyroideal shoaly rivalry pseudosatirical nonappealable Pleuronectes.' != u'a326e942 malapplication dyce renounce nonqualification stackful Amphion upbring defectibility theriotrophical unsanctimoniousness haemoconcentration terrine ochlocratically thyroideal shoaly rivalry pseudosatirical nonappealable Pleuronect ...'

Attachments (0)

Change History (5)

comment:1 by Jun Omae, 7 years ago

That failure occurs when random_sentence() generates text over 240 characters. Snippet of the searching result would be shorten with 240 characters. However, I don't think we need random text in the unit tests.

  • trac/ticket/tests/roadmap.py

    diff --git a/trac/ticket/tests/roadmap.py b/trac/ticket/tests/roadmap.py
    index 44dda52c2..c8bcd8585 100644
    a b import unittest  
    1818from trac.core import ComponentManager
    1919from trac.resource import ResourceNotFound
    2020from trac.test import EnvironmentStub, MockRequest
    21 from trac.tests.contentgen import random_sentence
    2221from trac.ticket.model import Ticket
    2322from trac.ticket.roadmap import (
    2423    DefaultTicketGroupStatsProvider, Milestone, MilestoneModule,
    class MilestoneModuleTestCase(unittest.TestCase):  
    158157            m = Milestone(self.env)
    159158            m.name = term
    160159            m.due = datetime_now(utc)
    161             m.description = random_sentence()
     160            m.description = u"""\
     161Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod \
     162tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \
     163veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea \
     164commodo consequat. Duis aute irure dolor in reprehenderit in voluptate \
     165velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat \
     166cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id \
     167est laborum."""
    162168            m.insert()
    163169
    164170    def tearDown(self):
    class MilestoneModuleTestCase(unittest.TestCase):  
    198204        self.assertEqual('Milestone ' + milestone.name, results[0][1])
    199205        self.assertEqual(milestone.due, results[0][2])
    200206        self.assertEqual('', results[0][3])
    201         self.assertEqual(milestone.description, results[0][4])
     207        shorten_desc = u"""\
     208Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod \
     209tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, \
     210quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \
     211consequat. Duis a ..."""
     212        self.assertEqual(shorten_desc, results[0][4])
    202213
    203214    def test_get_search_results_matches_ignorecase(self):
    204215        req = MockRequest(self.env)

comment:2 by Ryan J Ollos, 7 years ago

Milestone: next-stable-1.0.x1.0.14

That change looks good to me.

comment:3 by Jun Omae, 7 years ago

Release Notes: modified (diff)

Thanks. Committed in [15266] and merged in [15267-15268].

comment:4 by Jun Omae, 7 years ago

Resolution: fixed
Status: newclosed

comment:5 by Jun Omae, 7 years ago

Owner: set to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.