Commits

Greg Ward committed 5f0c676

Add whitespace to improve PEP8 conformance.
This fixes all PEP 8 violations detected by the pep8 tool *except* "line too long".

  • Participants
  • Parent commits 832870e

Comments (0)

Files changed (1)

File src/eximunit/smtp.py

 ACCEPTED = 250
 MAILBOX_UNAVAILABLE = 550
 
+
 def assertMatches(regex, msg, failMsg=None):
     if re.compile(regex).match(msg) is None:
         if failMsg:
            Theoretically you could override this method to sort out a Python SMTP session to
            any server, not just Exim."""
         self.smtp = EximDebugSMTP(fromHost=self.fromIP, debug=self.debug)
-        self.smtp.helo() # TODO optional support for ESMTP?
+        self.smtp.helo()        # TODO optional support for ESMTP?
 
     def close(self):
         self.smtp.close()
         """Issues an RCPT TO for rcpt and asserts that it worked"""
         code, resp = self.smtp.rcpt(rcpt)
         _assertResponse(ACCEPTED, code, resp)
-        return self        
+        return self
 
-    def assertRcptToRejected(self, rcpt, expectedMessage = None):
+    def assertRcptToRejected(self, rcpt, expectedMessage=None):
         """Issues an RCPT TO for rcpt and asserts that it worked"""
         code, resp = self.smtp.rcpt(rcpt)
         _assertResponse(MAILBOX_UNAVAILABLE, code, resp)
         if expectedMessage:
             assertMatches(expectedMessage, resp, "Response message did not match expectation")
-        return self     
+        return self
 
     def randomData(self):
         """Sends a 'random' message as the DATA and asserts that it's accepted"""
     def assertVirusAccepted(self):
         return self.data(readFile('eicar.txt'))
 
-    def assertDataRejected(self, dataFile, expectedMessage = None):
+    def assertDataRejected(self, dataFile, expectedMessage=None):
         data = self._getData(dataFile)
         code, resp = self.smtp.data(data)
         assert MAILBOX_UNAVAILABLE == code, resp
             result = []
             for x in initial:
                 result.extend(self.recursiveExpn(x))
-        return result        
+        return result
 
     def _getData(self, fileName):
         dataFile = os.path.join(os.path.abspath(os.path.dirname(__file__)), fileName)
         assert ACCEPTED == code, resp
         return self
 
+
 def _assertResponse(expectcode, code, resp):
     assert expectcode == code, (
         "expected %s but got %s (response: %r)" %
         (expectcode, code, resp))
 
+
 def findFreePorts(howMany=1):
     """Return a list of n free port numbers on localhost"""
     results = []
 
     return results
 
+
 class EximDebugSMTP(SMTP):
     """Extension of smtplb's SMTP which is backed by an Exim fake SMTP sesion"""
 
         if self.debuglevel > 0:
             print "Spawning exim on port %s with incoming address %s" % (port, self.fromHost)
         ncProcess = Popen(ncCmd, stdout=PIPE)
-        threading.Thread(target=ncProcess.communicate).start() # TODO maybe just fork nc?
-        time.sleep(2) # give exim a moment to sort itself out
+         # TODO maybe just fork nc?
+        threading.Thread(target=ncProcess.communicate).start()
+        time.sleep(2)           # give exim a moment to sort itself out
 
-        # now connect and discard the first few lines (the header about this being a fake session)
+        # now connect and discard the first few lines (the header about
+        # this being a fake session)
         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         s.connect(('localhost', port))
         # skip the introductory 'not real' message, leaving it
         # just before reading the 220 and the banner
         while s.recv(1) != "!":
             pass
-        s.recv(2) # two newlines after 'not for real!'
+        s.recv(2)               # two newlines after 'not for real!'
         return s