Edgewall Software

Opened 10 years ago

Closed 8 years ago

#11642 closed enhancement (fixed)

Test failures with Twill 1.8.0 — at Version 3

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

Enforce Twill required version of 0.9 or 0.9.1.

API Changes:
Internal Changes:

Description

As mentioned on the mailing list (gdiscussion:trac-dev:sCRapSYsEGQ). After installing the dependencies of Twill 1.8.0: requests lxml and cssselect (pull request #6 is needed to improve handling of the package dependencies), the first error encountered is:

$ python ./trac/tests/functional/__init__.py
Traceback (most recent call last):
  File "./trac/tests/functional/__init__.py", line 221, in <module>
    unittest.main(defaultTest='suite')
  File "/usr/lib/python2.7/unittest/main.py", line 95, in __init__
    self.runTests()
  File "/usr/lib/python2.7/unittest/main.py", line 232, in runTests
    self.result = testRunner.run(self.test)
  File "/usr/lib/python2.7/unittest/runner.py", line 151, in run
    test(result)
  File "/usr/lib/python2.7/unittest/suite.py", line 70, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.7/unittest/suite.py", line 108, in run
    test(result)
  File "/usr/lib/python2.7/unittest/suite.py", line 70, in __call__
    return self.run(*args, **kwds)
  File "/home/user/Workspace/newtwill/teo-rjollos.git/trac/test.py", line 137, in run
    self.setUp()
  File "./trac/tests/functional/__init__.py", line 151, in setUp
    self._testenv.start()
  File "/home/user/Workspace/newtwill/teo-rjollos.git/trac/tests/functional/testenv.py", line 271, in start
    tc.go(self.url)
  File "/home/user/Workspace/newtwill/py2.7/local/lib/python2.7/site-packages/twill-1.8.0-py2.7.egg/twill/commands.py", line 109, in go
    browser.go(url)
  File "/home/user/Workspace/newtwill/py2.7/local/lib/python2.7/site-packages/twill-1.8.0-py2.7.egg/twill/browser.py", line 91, in go
    raise TwillException("cannot go to '%s'" % (url,))
twill.errors.TwillException: cannot go to 'http://127.0.0.1:8170'

Package versions are:

>>> import twill
>>> twill.__version__
'0.9'
>>> twill.__path__
['/home/user/Workspace/newtwill/py2.7/local/lib/python2.7/site-packages/twill-1.8.0-py2.7.egg/twill']
>>> import requests
>>> requests.__version__
'2.3.0'
>>> import lxml
>>> lxml.etree.LXML_VERSION
(3, 3, 5, 0)
>>> import cssselect
>>> cssselect.__version__
'0.9.1'

The version is in the Twill package on PyPI is incorrect. The version has been fixed in the codebase.

Change History (3)

comment:1 by Ryan J Ollos, 8 years ago

Milestone: undecided1.2
Owner: set to Ryan J Ollos
Status: newassigned

We could just require version 0.9 and focus on #11988. I found that twill.__version__ is 0.9 even when 0.9.1 is installed.

  • trac/tests/functional/__init__.py

    diff --git a/trac/tests/functional/__init__.py b/trac/tests/functional/__init__.py
    index a4668ff..9cd53c8 100755
    a b import sys  
    6464import time
    6565import unittest
    6666from datetime import datetime, timedelta
     67from pkg_resources import parse_version
    6768
    6869import trac
    6970from trac.tests.compat import rmtree
    if twill:  
    112113
    113114        tester_class = FunctionalTester
    114115
     116        def __init__(self):
     117            if parse_version(twill.__version__) != parse_version('0.9'):
     118                raise ImportError("Twill 0.9 is required. Found version %s."
     119                                  % twill.__version__)
     120            super(FunctionalTestSuite, self).__init__()
     121
    115122        def setUp(self, port=None):
    116123            """If no port is specified, use a semi-random port and subdirectory
    117124            'testenv'; but if a port is specified, use that port and

comment:2 by Christian Boos, 8 years ago

Yes, I think we should not invest more time on Twill, I doubt 1.8 or later version will add JavaScript support for example.

I did some experiments with Selenium, and I was very favorably impressed, I think it will be possible at some point to simply switch our functional tests over to use selenium. Of course, it'll be quite some work (#11988), but I rather see the effort spent there rather than on supporting a newer Twill version.

comment:3 by Ryan J Ollos, 8 years ago

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

I'm looking forward to selenium. While I might be getting better at regex writing due to Twill, overall I'd say it's not very productive for functional tests.

Changes committed to 0.12-stable in [14792], merged to 1.0-stable in [14793], merged to trunk in [14794].

Note: See TracTickets for help on using tickets.