Edgewall Software

Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#12663 closed defect (fixed)

Test failures running individual tests in trac.ticket.tests.notification — at Version 3

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.3.2
Component: ticket system Version:
Severity: normal Keywords: notification
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Use setUpModule and tearDownModule in trac.ticket.tests.notification to avoid test failures when running individual test cases rather than all tests in the module.

Description

There are test failures executing individual test cases in trac.ticket.tests.notification. The entire suite must be run for the tests to pass.

$python -m unittest trac.ticket.tests.notification.test_suite
...............................................................
----------------------------------------------------------------------
Ran 63 tests in 7.089s

OK
$python -m unittest trac.ticket.tests.notification
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
======================================================================
ERROR: test_author_full_name (trac.ticket.tests.notification.AttachmentNotificationTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "trac/ticket/tests/notification.py", line 1551, in setUp
    config_smtp(self.env)
  File "trac/ticket/tests/notification.py", line 76, in config_smtp
    env.config.set('notification', 'smtp_server', notifysuite.smtpd.host)
AttributeError: 'NoneType' object has no attribute 'smtpd'
...

----------------------------------------------------------------------
Ran 63 tests in 0.526s

FAILED (errors=63)
$python -m unittest trac.ticket.tests.notification.RecipientTestCase
EEEEEEEEEEEE
======================================================================
ERROR: test_always_notify_owner (trac.ticket.tests.notification.RecipientTestCase)
The `always_notify_owner` option.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "trac/ticket/tests/notification.py", line 86, in setUp
    config_smtp(self.env)
  File "trac/ticket/tests/notification.py", line 76, in config_smtp
    env.config.set('notification', 'smtp_server', notifysuite.smtpd.host)
AttributeError: 'NoneType' object has no attribute 'smtpd'
...

----------------------------------------------------------------------
Ran 12 tests in 0.111s

FAILED (errors=12)
$python -m unittest trac.ticket.tests.notification.RecipientTestCase.test_no_recipients
E
======================================================================
ERROR: test_no_recipients (trac.ticket.tests.notification.RecipientTestCase)
No recipient case
----------------------------------------------------------------------
Traceback (most recent call last):
  File "trac/ticket/tests/notification.py", line 86, in setUp
    config_smtp(self.env)
  File "trac/ticket/tests/notification.py", line 76, in config_smtp
    env.config.set('notification', 'smtp_server', notifysuite.smtpd.host)
AttributeError: 'NoneType' object has no attribute 'smtpd'

----------------------------------------------------------------------
Ran 1 test in 0.013s

FAILED (errors=1)

Change History (3)

comment:1 by Ryan J Ollos, 7 years ago

Milestone: 1.2.11.3.2
Release Notes: modified (diff)

In Python 2.7 we can use setUpModule and tearDownModule. Proposed changes in log:rjollos.git:t12663_setup_teardown_modules.

comment:2 by Ryan J Ollos, 7 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r15359.

comment:3 by Ryan J Ollos, 4 years ago

Internal Changes: modified (diff)
Release Notes: modified (diff)
Note: See TracTickets for help on using tickets.