Skip to content

Commit 56bcf7d

Browse files
committed
Merge pull request #6 from asgeroverby/master
Add support for Python 3
2 parents 9c591fc + c23ad18 commit 56bcf7d

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

QuickStart.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,9 @@ installing additional docutils__ module::
129129

130130
pip install docutils
131131

132-
Notice that at the time of this writing Python 3 is not yet officially
133-
supported. See the aforementioned `installation instructions`_ for information
134-
about an unofficial Python 3 port and the latest status of Python 3 support in
135-
general.
132+
Notice that Robot Framework 3.0 is the first Robot Framework version to support
133+
Python 3. See the aforementioned `installation instructions`_ for information
134+
about Python 2 vs Python 3.
136135

137136
.. _`Robot Framework installation instructions`:
138137
https://github.com/robotframework/robotframework/blob/master/INSTALL.rst

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ through it and look at the examples, but you can also use the guide as
77
an executable demo.
88

99
The guide itself is in `<QuickStart.rst>`_ file. It replaces the old version
10-
still available on the `old project pages`__.
10+
still available on the `old project pages`__. Robot Framework 3.0 introduced
11+
python 3 support. This guide executes under Python 2.7, 3.3, and newer.
1112

1213
Copyright © Nokia Solutions and Networks. Licensed under the
1314
`Creative Commons Attribution 3.0 Unported`__ license.

lib/LoginLibrary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ def status_should_be(self, expected_status):
2626

2727
def _run_command(self, command, *args):
2828
command = [sys.executable, self._sut_path, command] + list(args)
29-
process = subprocess.Popen(command, stdout=subprocess.PIPE,
29+
process = subprocess.Popen(command, universal_newlines=True, stdout=subprocess.PIPE,
3030
stderr=subprocess.STDOUT)
3131
self._status = process.communicate()[0].strip()

sut/login.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
4+
35
import os.path
46
import sys
57
import tempfile
@@ -27,7 +29,7 @@ def _read_users(self, path):
2729
def create_user(self, username, password):
2830
try:
2931
user = User(username, password)
30-
except ValueError, err:
32+
except ValueError as err:
3133
return 'Creating user failed: %s' % err
3234
self.users[user.username] = user
3335
return 'SUCCESS'
@@ -47,7 +49,7 @@ def change_password(self, username, old_pwd, new_pwd):
4749
if not self._is_valid_user(username, old_pwd):
4850
raise ValueError('Access Denied')
4951
self.users[username].password = new_pwd
50-
except ValueError, err:
52+
except ValueError as err:
5153
return 'Changing password failed: %s' % err
5254
else:
5355
return 'SUCCESS'
@@ -104,21 +106,21 @@ def _validate_password_chars(self, password):
104106

105107
def login(username, password):
106108
with UserDataBase() as db:
107-
print db.login(username, password)
109+
print(db.login(username, password))
108110

109111

110112
def create_user(username, password):
111113
with UserDataBase() as db:
112-
print db.create_user(username, password)
114+
print(db.create_user(username, password))
113115

114116

115117
def change_password(username, old_pwd, new_pwd):
116118
with UserDataBase() as db:
117-
print db.change_password(username, old_pwd, new_pwd)
119+
print(db.change_password(username, old_pwd, new_pwd))
118120

119121

120122
def help():
121-
print ('Usage: %s { create | login | change-password | help }'
123+
print('Usage: %s { create | login | change-password | help }'
122124
% os.path.basename(sys.argv[0]))
123125

124126

0 commit comments

Comments
 (0)