Edgewall Software
Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11332 closed enhancement (fixed)

Allow test cases in `trac.tests.functional.testcases` to be run in isolation

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

Reorganized tests cases so that trac.tests.functional.testcases can be executed in isolation, and trac.tests.functional.__init__ continues to execute the entire functional test suite for the project.

Internal Changes:

Description (last modified by Ryan J Ollos)

It is currently not possible to execute the test cases in trac.tests.functional.testcases in isolation since trac.tests.functional.testcases:suite adds all of the functional test cases in the project to the functionalSuite. The only workaround is to comment out addTest calls. It should be possible resolve this issue by instead building the suite for the entire project in trac.tests.functional.__init__.

Attachments (0)

Change History (5)

comment:1 by Ryan J Ollos, 11 years ago

Here is a brief description of what I see, in order to provide justification for the proposed changes.

trac/tests contains unit test modules for each module located directly in trac/ (e.g. the test module for trac/attachments.py is trac/tests/attachment.py). For each package that has functional tests, the tests are located in functional.py within the tests directory. There is one exception - since there is a directory trac/tests/functional, rather than having a functional tests module trac/tests/functional.py, the tests reside in trac/tests/functional/testcases.py. I assume it was done this was to avoid possible ambiguity when importing from trac.tests.functional.

The changes proposed in log:rjollos.git:t11332 make trac/tests/functional/testcases.py a standalone functional test module just like, e.g., trac/admin/tests/functional.py or trac/ticket/tests/functional.py, and trac/tests/functional/__init__.py becomes the test runner for all of the functional tests.

Previously, both python -m trac.tests.functional.__init__ and python -m trac.tests.functional.testcases execute the entire functional test suite. With the changes in log:rjollos.git:t11332, python -m trac.tests.functional.__init__ executes the entire functional test suite and python -m trac.tests.functional.testcases executes just the test cases in that module.

comment:2 by Ryan J Ollos, 11 years ago

Status: newassigned

comment:3 by Ryan J Ollos, 11 years ago

API Changes: modified (diff)
Description: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.0-stable in [12178] and merged to trunk in [12179].

in reply to:  1 comment:4 by Ryan J Ollos, 11 years ago

Replying to rjollos:

With the changes in log:rjollos.git:t11332, python -m trac.tests.functional.__init__ executes the entire functional test suite and python -m trac.tests.functional.testcases executes just the test cases in that module.

I'm not sure why I haven't encountered this error until just now, but I'm seeing:

$ python --version
Python 2.5.6
$ PYTHONPATH=. python -m trac.tests.functional.__init__
SKIP: validation of XHTML output in functional tests (no lxml installed)
SKIP: fine-grained permission tests. ConfigObj not installed.
Traceback (most recent call last):
  File "/usr/lib/python2.5/runpy.py", line 95, in run_module
    filename, loader, alter_sys)
  File "/usr/lib/python2.5/runpy.py", line 52, in _run_module_code
    mod_name, mod_fname, mod_loader)
  File "/usr/lib/python2.5/runpy.py", line 32, in _run_code
    exec code in run_globals
  File "/home/user/Workspace/t11329/teo-rjollos.git/trac/tests/functional/__init__.py", line 78, in <module>
    from better_twill import twill, b, tc, ConnectError
ImportError: No module named better_twill

The issue is fixed by:

  • trac/tests/functional/__init__.py

    diff --git a/trac/tests/functional/__init__.py b/trac/tests/functional/__init__.
    index 9166e74..5d436ed 100755
    a b from trac.util.compat import close_fds  
    7575# is allowed to load first, its (unmodified) copy will always be loaded.
    7676import subprocess
    7777
    78 from better_twill import twill, b, tc, ConnectError
     78from trac.tests.functional.better_twill import twill, b, tc, ConnectError
    7979
    8080try:
    8181    # This is the first indicator of whether the subversion bindings are

comment:5 by Ryan J Ollos, 11 years ago

Change from comment:4 committed to 0.12-stable in [12255], merged to 1.0-stable in [12256] and merged to trunk in [12257].

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.