use getpass.getuser instead of os.getlogin

os.getlogin doesn't work everywhere (can raise OSError, inappropriate ioctl for device)
pull/789/head
Min RK 2019-09-08 11:54:22 +02:00
rodzic 3f8e56d0d9
commit f47acaa1bd
4 zmienionych plików z 10 dodań i 5 usunięć

Wyświetl plik

@ -5,6 +5,7 @@ import os
import subprocess
import tempfile
import time
from getpass import getuser
def test_env():
@ -13,7 +14,7 @@ def test_env():
"""
ts = str(time.time())
with tempfile.TemporaryDirectory() as tmpdir:
username = os.getlogin()
username = getuser()
subprocess.check_call(
[
"repo2docker",

Wyświetl plik

@ -7,6 +7,7 @@ import time
import os
import tempfile
import random
from getpass import getuser
import docker
import pytest
@ -46,7 +47,7 @@ def read_port_mapping_response(
request.addfinalizer(td.cleanup)
tmpdir.chdir()
username = os.getlogin()
username = getuser()
tmpdir.mkdir("username")
r2d = Repo2Docker(
repo=str(tmpdir.mkdir("repo")),

Wyświetl plik

@ -5,6 +5,7 @@ import os
import subprocess
import tempfile
import time
from getpass import getuser
from unittest import mock
from repo2docker import Repo2Docker
@ -26,7 +27,7 @@ def test_user():
"""
ts = str(time.time())
# FIXME: Use arbitrary login here, We need it now since we wanna put things to volume.
username = os.getlogin()
username = getuser()
userid = str(os.geteuid())
with tempfile.TemporaryDirectory() as tmpdir:
tmpdir = os.path.realpath(tmpdir)

Wyświetl plik

@ -1,10 +1,12 @@
"""
Test that volume mounts work when running
"""
import os
import subprocess
import tempfile
import time
from getpass import getuser
def test_volume_abspath():
@ -15,7 +17,7 @@ def test_volume_abspath():
with tempfile.TemporaryDirectory() as tmpdir:
tmpdir = os.path.realpath(tmpdir)
username = os.getlogin()
username = getuser()
subprocess.check_call(
[
"repo2docker",
@ -54,7 +56,7 @@ def test_volume_relpath():
"--user-id",
str(os.geteuid()),
"--user-name",
os.getlogin(),
getuser(),
tmpdir,
"--",
"/bin/bash",