Skip to content

Commit

Permalink
Merge pull request #333 from dkuznetsov/master
Browse files Browse the repository at this point in the history
Added a safeguard in an example and fixed a test
  • Loading branch information
fafhrd91 committed Apr 19, 2015
2 parents a08111c + f110bb4 commit 3560de5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions examples/mpsrv.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ def start(self):


def main():
if getattr(os, "fork", None) is None:
print("os.fork isn't supported by your OS")
return
args = ARGS.parse_args()
if ':' in args.host:
args.host, port = args.host.split(':', 1)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_web_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ def test_post_single_file(self):

def check_file(fs):
fullname = os.path.join(here, fs.filename)
with open(fullname, 'rb') as f:
test_data = f.read()
with open(fullname, 'r') as f:
test_data = f.read().encode()
data = fs.file.read()
self.assertEqual(test_data, data)

Expand Down Expand Up @@ -188,8 +188,8 @@ def test_post_files(self):

def check_file(fs):
fullname = os.path.join(here, fs.filename)
with open(fullname, 'rb') as f:
test_data = f.read()
with open(fullname, 'r') as f:
test_data = f.read().encode()
data = fs.file.read()
self.assertEqual(test_data, data)

Expand Down Expand Up @@ -265,7 +265,7 @@ def go(dirname, filename):
resp = yield from request('GET', url, loop=self.loop)
self.assertEqual(200, resp.status)
txt = yield from resp.text()
self.assertEqual('file content\n', txt)
self.assertEqual('file content{}'.format(os.linesep), txt)
ct = resp.headers['CONTENT-TYPE']
self.assertEqual('application/octet-stream', ct)
self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)
Expand Down

0 comments on commit 3560de5

Please sign in to comment.