Opened 2 years ago

Closed 18 months ago

#8602 defect closed duplicate (duplicate)

test_cgi fails on Python 3

Reported by: Abhishek Choudhary Owned by:
Priority: normal Milestone: Python-3.x
Component: core Keywords:
Cc: Branch:


If I do this with Python 2:

python2 bin/trial twisted/web/test/
    test_notFoundChild ...                                                 [OK]
    test_render ...                                                        [OK]
    test_prematureEndOfHeaders ...                                         [OK]
    test_pathInfo ...                                                      [OK]
    testCGI ...                                                            [OK]
    testReadAllInput ...                                                   [OK]
    testReadEmptyInput ...                                                 [OK]
    testReadInput ...                                                      [OK]
    test_duplicateHeaderCGI ...                                            [OK]
    test_malformedHeaderCGI ...                                            [OK]
    test_noDuplicateContentTypeHeaders ...                                 [OK]
    test_protectedServerAndDate ...                                        [OK]
    test_useReactorArgument ...                                            [OK]

Ran 13 tests in 0.345s

PASSED (successes=13)

but with python 3

 python3 bin/trial twisted/web/test/
  py ...                                                                [ERROR]

Traceback (most recent call last):
  File "/home/ac/Twisted/twisted/trial/", line 781, in loadByName
    return self.suiteFactory([self.findByName(name, recurse=recurse)])
  File "/home/ac/Twisted/twisted/trial/", line 682, in findByName
    return self.loadFile(_name, recurse=recurse)
  File "/home/ac/Twisted/twisted/trial/", line 652, in loadFile
    module = SourceFileLoader(name, fileName).load_module()
  File "<frozen importlib._bootstrap_external>", line 385, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 806, in load_module
  File "<frozen importlib._bootstrap_external>", line 665, in load_module
  File "<frozen importlib._bootstrap>", line 268, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 662, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "twisted/web/test/", line 14, in <module>
    from twisted.web import client, twcgi, server, resource
  File "/home/ac/Twisted/twisted/web/", line 17, in <module>
    from twisted.spread import pb
  File "/home/ac/Twisted/twisted/spread/", line 46, in <module>
    from twisted.spread.jelly import jelly, unjelly, globalSecurity
  File "/home/ac/Twisted/twisted/spread/", line 70, in <module>
    from types import StringType
builtins.ImportError: cannot import name 'StringType'

Ran 1 tests in 0.064s

FAILED (errors=1)

Change History (1)

comment:1 Changed 18 months ago by Craig Rodrigues

Resolution: duplicate
Status: newclosed

Duplicate of ticket:8009

Note: See TracTickets for help on using tickets.