Opened 17 months ago

Closed 6 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:
Author:

Description

If I do this with Python 2:

python2 bin/trial twisted/web/test/test_cgi.py
twisted.web.test.test_cgi
  CGIDirectoryTests
    test_notFoundChild ...                                                 [OK]
    test_render ...                                                        [OK]
  CGIProcessProtocolTests
    test_prematureEndOfHeaders ...                                         [OK]
  CGIScriptTests
    test_pathInfo ...                                                      [OK]
  CGITests
    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/test_cgi.py
twisted/web/test/test_cgi
  py ...                                                                [ERROR]

===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/home/ac/Twisted/twisted/trial/runner.py", line 781, in loadByName
    return self.suiteFactory([self.findByName(name, recurse=recurse)])
  File "/home/ac/Twisted/twisted/trial/runner.py", line 682, in findByName
    return self.loadFile(_name, recurse=recurse)
  File "/home/ac/Twisted/twisted/trial/runner.py", 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/test_cgi.py", line 14, in <module>
    from twisted.web import client, twcgi, server, resource
  File "/home/ac/Twisted/twisted/web/twcgi.py", line 17, in <module>
    from twisted.spread import pb
  File "/home/ac/Twisted/twisted/spread/pb.py", line 46, in <module>
    from twisted.spread.jelly import jelly, unjelly, globalSecurity
  File "/home/ac/Twisted/twisted/spread/jelly.py", line 70, in <module>
    from types import StringType
builtins.ImportError: cannot import name 'StringType'

twisted/web/test/test_cgi.py
-------------------------------------------------------------------------------
Ran 1 tests in 0.064s

FAILED (errors=1)

Change History (1)

comment:1 Changed 6 months ago by Craig Rodrigues

Resolution: duplicate
Status: newclosed

Duplicate of ticket:8009

Note: See TracTickets for help on using tickets.