Skip to content

Commit 371a594

Browse files
Improve unit tests
1 parent 87158c6 commit 371a594

6 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/robotide/postinstall/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"or pip install wxPython")
3030
exit(-1)
3131

32-
from os import environ, getlogin
32+
from getpass import getuser
33+
from os import environ
3334
from os.path import exists, join
3435
from robotide.widgets import RIDEDialog
3536

@@ -254,7 +255,7 @@ def _create_desktop_shortcut_mac(frame=None):
254255
if exists(ride_app_pc_path):
255256
shutil.rmtree(ride_app_pc_path, True)
256257
shutil.copytree(ride_app_module_path, ride_app_pc_path)
257-
user = getlogin()
258+
user = getuser()
258259
user_desktop_link = '/Users/' + user + '/Desktop/' + ride_app_name
259260
if exists(user_desktop_link):
260261
os.remove(user_desktop_link)

utest/application/test_postinstaller.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,16 @@ def test_ask_directory_frame_ok(self):
213213
assert result is not None
214214

215215
global option_f
216-
from os import environ, getlogin
216+
from getpass import getuser
217+
from os import environ
217218
from os.path import exists, join
218219
DEFAULT_LANGUAGE = environ.get('LANG', '').split(':')
219220

220221
def reset_shortcut():
221222
desktop = {"de": "Desktop", "en": "Desktop", "es": "Escritorio",
222223
"fi": r"Työpöytä", "fr": "Bureau", "it": "Scrivania",
223224
"pt": r"Área de Trabalho", "zh": "Desktop"}
224-
user = getlogin()
225+
user = getuser()
225226
ndesktop = desktop[DEFAULT_LANGUAGE[0][:2]]
226227
directory = join("/home", user, ndesktop)
227228
defaultdir = join("/home", user, "Desktop")
6 KB
Binary file not shown.
94 Bytes
Binary file not shown.
122 Bytes
Binary file not shown.
146 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)