You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I use interpy in my testing suite and run python -m tabnanny [file] it doesn't show any errors. But when i run nosetests [file] I get an IndentationError:
E
======================================================================
ERROR: Failure: IndentationError (unindent does not match any outer indentation level (server_communication_test.py, line 19))
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/brendanberman/.pyenv/versions/2.7.10/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/Users/brendanberman/.pyenv/versions/2.7.10/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Users/brendanberman/.pyenv/versions/2.7.10/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/xxx/tests/server/server_communication_test.py", line 19
websocket_testing_port = 9876
^
IndentationError: unindent does not match any outer indentation level
----------------------------------------------------------------------
Ran 1 test in 0.006s
FAILED (errors=1)
# coding: interpy__author__='pcflmb'importunittestimportosfromnose.toolsimport*importcherrypyfromws4py.server.cherrypyserverimportWebSocketPlugin, WebSocketToolfromws4py.websocketimportEchoWebSocketclassServerCommunicationTest(unittest.TestCase):
""" Test to make sure our server is correctly createing a websocket, receiving data, and reconnecting on dropped connections. """websocket_testing_port=9876@classmethoddefsetup_class(self):
cherrypy.config.update({'server.socket_port': ServerCommunicationTest.websocket_testing_port})
WebSocketPlugin(cherrypy.engine).subscribe()
cherrypy.tools.websocket=WebSocketTool()
cherrypy.quickstart(Root(), '/', config={'/ws': {'tools.websocket.on': True,
'tools.websocket.handler_cls': EchoWebSocket}})
@classmethoddefteardown_class(self):
passdeftest_websocket_connecting(self):
websocket_client=ServerCommunication("ws://localhost:#{ServerCommunicationTest.websocket_testing_port}/ws")
deftest_websocket_connecting(self):
passclassRoot(object):
@cherrypy.exposedefindex(self):
return'some HTML with a websocket javascript connection'@cherrypy.exposedefws(self):
# you can access the class instance throughhandler=cherrypy.request.ws_handler
The text was updated successfully, but these errors were encountered:
Similar issue trying to execute a simple for loop:
#!/usr/bin/env python
# coding: interpy
import psycopg2, random
NUM_ACCOUNTS = 5
conn = psycopg2.connect("dbname=pgbench user=tag")
cur = conn.cursor()
for account in range(NUM_ACCOUNTS):
balance = random.randrange(1000)
cur.execute("UPDATE pgbench_accounts SET abalance = #{balance} WHERE aid = #{account+1};")
conn.commit()
cur.close()
conn.close()
Error:
$ ./randomizedb.py
File "./randomizedb.py", line 11
cur.execute( "UPDATE pgbench_accounts SET abalance = "+unicode(balance)+" WHERE aid = "+unicode(account+1 )+";" )
^
IndentationError: unindent does not match any outer indentation level
If I use interpy in my testing suite and run
python -m tabnanny [file]
it doesn't show any errors. But when i runnosetests [file]
I get an IndentationError:The text was updated successfully, but these errors were encountered: