Open crolfe opened 8 years ago
Yes - agreed. We could try to mock the FTP connections themselves, or we could make a mock NOAAClient, which just uses some mock data. I'm inclined to go for the latter - it's probably the simplest and most straightforward. I could try to throw in a stab at that into the 0.4 release candidate.
Sounds good. I was hoping to find a testing library for ftplib
that is similar to https://github.com/getsentry/responses for requests
, but no such luck. responses
does work well with pytest's fixtures, so I'd recommend it for testing HTTP requests.
Let me know if you need a hand with this.
I noticed that running the tests results in real FTP connections, which means tests will fail if the external FTP site is down or not connected to the Internet (plus it isn't very polite to the external service).
If we mock out the FTP connection code to return a simulated response, then the tests should be less brittle and should (hopefully) run quite a bit faster.