- はじめに - 「Webスクレイピングで情報を収集する」という内容は多い。 しかし、Webスクレイピングのコードは肥大化しやすいだけでなく、細かな変更が多くなる。 テストを書いて変更の影響をちゃんと見ておく必要性が高い。 unittestとhttp.serverを使ったテストの実装についてメモしておく。 参考:python - How to stop BaseHTTPServer.serve_forever() in a BaseHTTPRequestHandler subclass? - Stack Overflow - http.server - http.serverはPython 2.xではSimpleHTTPServerと呼ばれていたもの。 (http.serverよりSimpleHTTPServerの方がググラビリティ高いかも) Webサービス等の開発用にローカルサーバとして