Skip to content

os.getlogin() fails in tests #1156

Closed
Closed
@ml31415

Description

@ml31415
import os

def test_pytest():
    name = os.getlogin()
    assert name
    print name

Running this as a test script fails with:

========================================== test session starts ===========================================
platform linux2 -- Python 2.7.9, pytest-2.8.2, py-1.4.30, pluggy-0.3.1
rootdir: /home/michael/workspace, inifile: 
collected 1 items 

test_pytest.py F

================================================ FAILURES ================================================
______________________________________________ test_pytest _______________________________________________

    def test_pytest():
>       name = os.getlogin()
E       OSError: [Errno 25] Inappropriate ioctl for device

test_pytest.py:4: OSError
======================================== 1 failed in 0.00 seconds ========================================

Outside the test environment, within the same shell, this runs without error. Is this intended behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions