Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

#12456 closed defect (fixed)

AssertionError: "<MODULE.eh_ix object at 0xADDRESS (repr() error: TypeError: unsupported operand type(s) for +: 'int' and 'str')>"

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.11
Component: general Version:
Severity: normal Keywords: tests
Cc: Branch:
Release Notes:

Fixed test failures when running make test=trac/util/tests/__init__ and python trac/ticket/tests/default_workflow.py.

API Changes:
Internal Changes:

Description

Unit test fails when running tests for just the module, but passes when running the entire suite (make unit-test).

$make test=trac/util/tests/__init__

Python: /Users/rjollos/Documents/Workspace/trac-dev/pve/bin/python 

  Package        Version                                                                                          
  ----------------------------------------------------------------------------------------------------------------
  Python       : 2.7.11 (default, Dec  5 2015, 14:44:53) 
  [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)]
  Setuptools   : 20.6.7                                                                                           
  Genshi       : 0.6.1                                                                                            
  Babel        : 2.3.2                                                                                            
  sqlite3      : 2.6.0 (3.12.1)                                                                                   
  PySqlite     : 2.8.1 (3.8.10.2)                                                                                 
  MySQLdb      : 1.2.5                                                                                            
  Psycopg2     : 2.6.1 (dt dec pq3 ext lo64)                                                                      
  SVN bindings : 1.9.3 (r1718519)                                                                                 
  Mercurial    : 3.7.2                                                                                            
  Pygments     : 2.1.3                                                                                            
  Textile      : 2.2.2                                                                                            
  Pytz         : 2016.3                                                                                           
  Docutils     : 0.12                                                                                             
  Twill        : 0.9                                                                                              
  LXML         : 3.5.0                                                                                            
  coverage     : 4.0.3                                                                                            
  figleaf      : 0.6.1                                                                                            

Variables:
  PATH=::$PATH
  PYTHONPATH=.::$PYTHONPATH
  TRAC_TEST_DB_URI=
  server-options= -p 8000 -a '*,/Users/rjollos/Documents/Workspace/trac-dev/tracenvs/htdigest.trac,trac' -r -e /Users/rjollos/Documents/Workspace/trac-dev/tracenvs

External dependencies:
-n   Git version: 
git version 2.8.1

python  setup.py -q test -s trac.util.tests.__init__.suite 
...........F.........................................................................................................................................................................................................................................
======================================================================
FAIL: test_buggy_repr (trac.util.tests.__init__.SafeReprTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/util/tests/__init__.py", line 182, in test_buggy_repr
    "type(s) for +: 'int' and 'str')>", sr)
AssertionError: "<MODULE.eh_ix object at 0xADDRESS (repr() error: TypeError: unsupported operand type(s) for +: 'int' and 'str')>" != u"<MODULE.__init__.eh_ix object at 0xADDRESS (repr() error: TypeError: unsupported operand type(s) for +: 'int' and 'str')>"

----------------------------------------------------------------------
Ran 245 tests in 1.040s

FAILED (failures=1)
make: *** [all] Error 1

Attachments (0)

Change History (4)

comment:1 by Ryan J Ollos, 5 years ago

Proposed change:

  • trac/util/tests/__init__.py

    diff --git a/trac/util/tests/__init__.py b/trac/util/tests/__init__.py
    index be96eeb..39bbaf8 100644
    a b class SafeReprTestCase(unittest.TestCase):  
    178178        self.assertRaises(Exception, repr, eh_ix())
    179179        sr = util.safe_repr(eh_ix())
    180180        sr = re.sub('[A-F0-9]{4,}', 'ADDRESS', sr)
    181         sr = re.sub(r'__main__|trac\.util\.tests', 'MODULE', sr)
     181        sr = re.sub(r'__main__|trac\.util\.tests(\.__init__)?', 'MODULE', sr)
    182182        self.assertEqual("<MODULE.eh_ix object at 0xADDRESS "
    183183                         "(repr() error: TypeError: unsupported operand "
    184184                         "type(s) for +: 'int' and 'str')>", sr)

comment:2 by Ryan J Ollos, 5 years ago

Another failure:

$python trac/ticket/tests/default_workflow.py
E.
======================================================================
ERROR: test_custom_reset_action (__main__.ResetActionTestCase)
Custom reset action in [ticket-workflow] section.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "trac/ticket/tests/default_workflow.py", line 65, in test_custom_reset_action
    self.perm_sys.grant_permission('user2', 'TICKET_BATCH_MODIFY')
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/perm.py", line 349, in grant_permission
    raise TracError(_('%(name)s is not a valid action.', name=action))
TracError: TICKET_BATCH_MODIFY is not a valid action.

----------------------------------------------------------------------
Ran 2 tests in 0.038s

The tests don't fail when run using make test=trac/ticket/tests/default_workflow.py.

Proposed fix:

  • trac/ticket/tests/default_workflow.py

    diff --git a/trac/ticket/tests/default_workflow.py b/trac/ticket/tests/default_workflow.py
    index c1befc0..cb52212 100644
    a b import trac.tests.compat  
    1717from trac.perm import PermissionCache, PermissionSystem
    1818from trac.test import EnvironmentStub, Mock
    1919from trac.ticket.api import TicketSystem
     20from trac.ticket.batch import BatchModifyModule
    2021from trac.ticket.model import Ticket
    2122
    2223

comment:3 by Jun Omae, 5 years ago

Looks good to me. Confirmed with:

$ git grep -l '^def suite():' | sed -e '\!^trac/test[.s]!d' | xargs make

comment:4 by Ryan J Ollos, 5 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks for testing. Committed to 1.0-stable in [14722], merged to trunk in [14723].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos 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.